Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error with suest command "xx could not be restored"

    Hi everyone!

    I am trying to regress the outputs from two different regressions my code looks somewhat like the following:

    HTML Code:
    use alldata
    drop if bottom_portfolio==1
    regress x y dummy1 dummy2 dummy3 dummy4
    estimates store top_portfolio
    
    
    use alldata
    drop if bottom_portfolio==0
    regress x y dummy1 dummy2 dummy3 dummy4
    estimates store bottom_portfolio
    
    suest top_regression bottom_regression
    i get the following error code :
    " estimation sample of the model saved under top_regression could not be restored
    r(198);"



    How can I solve this?

    Would really appreciate the help!

  • #2
    Do not drop data, but rather use the condition in your regression, e.g.,


    Code:
    use alldata
    regress x y dummy1 dummy2 dummy3 dummy4 if !bottom_portfolio
    estimates store top_portfolio

    Comment


    • #3
      hmm i am also manipulating the data from all to scratch, and my do file is already quite extensive and I am writing it in a way that I can apply it across various sets eg country industry division

      Is there no way to store the regression results, then manipulate again, regress store and compare thereafter?


      This is the structure my do file currently follows:
      Chapters:
      1. Opening complete dataset
      2. Correct date window and remove companies with missing observations
      3. Set and drop observations to get top 20% of [Industry; Within Industry; Country]
      a. set top 20% industry
      b. set top 20% division
      c. set top 20% within industry
      d. set top 20% country
      4. Calculate value weighted average of top portfolio
      a. calculating daily weighted averages
      b. reducing table size to only dummies and regression relevant specs
      5. Regress portfolio returns against market returns and add the included events dummies
      6. save/export coeffients and standard errors for every event
      7. Redo ch 1 - ch 6 for bottom 20%
      8. Perform two sample t test on coeficients and aggregated coefficients
      9. Format nicely and create final output
      Last edited by ties jongen; 05 May 2021, 05:35.

      Comment


      • #4
        You are asking: "Is there a way to estimate my regression, after I drop the data on which my regression is defined." The answer is very generally, No, you cannot estimate your regression if you have dropped your data beforehand.

        You might be misunderstanding what -suest- does: It estimates, it does not simply combine estimation results that exist already, but it estimates. I know this because in the stored estimates the covariance of the parameters in the two regressions is not present. -suest- calculates those with additional estimation.

        Originally posted by ties jongen View Post
        hmm i am also manipulating the data from all to scratch, and my do file is already quite extensive and I am writing it in a way that I can apply it across various sets eg country industry division

        Is there no way to store the regression results, then manipulate again, regress store and compare thereafter?


        This is the structure my do file currently follows:
        Chapters:
        1. Opening complete dataset
        2. Remove outliers, correct date window and remove companies with missing observations
        3. Set and drop observations to get top 20% of [Industry; Within Industry; Country]
        a. set top 20% industry
        b. set top 20% division
        c. set top 20% within industry
        d. set top 20% country
        4. Calculate value weighted average of top portfolio
        a. calculating daily weighted averages
        b. reducing table size to only dummies and regression relevant specs
        5. Regress portfolio returns against market returns and add the included events dummies
        6. save/export coeffients and standard errors for every event
        7. Redo ch 1 - ch 6 for bottom 20%
        8. Perform two sample t test on coeficients and aggregated coefficients
        9. Format nicely and create final output

        Comment


        • #5
          thank you for your answer;

          Would it work if I would write the script in a way that it would export the "table" after chapter 4 (and add a dummy for the portfolio it is in; eg. (1= top portfolio and 0 = bottom portfolio)
          then do chapter 1-4 for the bottom portfolio; export this table as well with the corresponding dummy
          thereafter append the two files;
          run and store the both regressions;
          then run suest?

          The export format of the table would look the following:
          I would regress the meanret on msciworld_exc_ret and on the event dummies after

          HTML Code:
          date    msciworld_excess_return    meanret    d_e1_5    d_e2_5    d_e3_5    d_e4_5
          31/08/2015    -.0076258    .00537739    0    0    0    0
          01/09/2015    -.0271782    -.03196324    0    0    0    0
          02/09/2015    .0093487    -.00337053    0    0    0    0
          03/09/2015    .0045    .01228631    0    0    0    0
          04/09/2015    -.0167791    -.0201263    0    0    0    0
          08/09/2015    .0177911    .01792618    0    0    0    0
          09/09/2015    .0006654    .00785138    0    0    0    0
          10/09/2015    -.001703    -.011211    1    0    0    0
          11/09/2015    .0009762    -.00844655    1    0    0    0
          14/09/2015    -.0041251    -.0057015    1    0    0    0
          15/09/2015    .0084772    .00159139    1    0    0    0
          16/09/2015    .0121165    .02974624    1    0    0    0
          17/09/2015    -.0005626    .0002806    1    0    0    0
          18/09/2015    -.0134267    -.0190928    1    0    0    0
          21/09/2015    -.0010788    -.00878104    1    0    0    0
          22/09/2015    -.0172922    -.02158263    1    0    0    0
          23/09/2015    -.0025614    -.01217949    1    0    0    0
          24/09/2015    -.0058133    -.00806042    1    0    0    0
          25/09/2015    .0046136    .00299614    0    0    0    0
          28/09/2015    -.0217343    -.03789479    0    0    0    0
          29/09/2015    -.0061595    -.00107269    0    0    0    0
          30/09/2015    .0203085    .02136067    0    0    0    0
          01/10/2015    .0038318    .00538688    0    0    0    0
          02/10/2015    .0120563    .02125733    0    0    0    0
          05/10/2015    .0188938    .04294595    0    0    0    0
          06/10/2015    .0021308    .0238574    0    0    0    0
          07/10/2015    .0076083    .03440584    0    0    0    0
          08/10/2015    .0061117    .01125257    0    0    0    0
          09/10/2015    .0061323    .01879123    0    0    0    0
          12/10/2015    .0003658    -.00979907    0    0    0    0
          13/10/2015    -.0079534    -.01669142    0    0    0    0
          Last edited by ties jongen; 05 May 2021, 06:07.

          Comment

          Working...
          X