Announcement

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

  • Error 301: last estimation results not found, nothing to store

    Dear Statalist,

    I want to store the results from the user written stata command "fuzzydid" (available via ssc).

    However after running the command and trying to store them, I get an error message stating 'last estimation results not found, nothing to restore'.

    Here is my code:

    Code:
    fuzzydid  Y G T D, did
    (running estim_wrapper on estimation sample)
    
    Bootstrap replications (50)
    ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
    ..................................................    50
    
    No method was specified to estimate E(Y|X), E(D|X) and P(D=d|X). Method set to default: ols.
    
    
    Estimator(s) of the local average treatment effect with bootstrapped standard errors. Number of
    observations:  16200 .
    
                 |      LATE    Std_Err          t    p_value   lower_ic   upper_ic
    -------------+------------------------------------------------------------------
           W_DID |  .1503901   .3717596   .4045358   .6858187  -.5271261   .8415557
    
    
    estimates store fuzzy_results
    last estimation results not found, nothing to store
    r(301);
    There are results stored in the ereturn list though:
    Code:
    . ereturn    list
    
    scalars:
        e(N)    =    16200
    
    matrices:
        e(ci_LATE)    :    1 x 2
        e(se_LATE)    :    1 x 1
        e(b_LATE)    :    1 x 1
    I am wondering where the errors is.

    Help would be much appreciated.

    Best
    Marius

  • #2
    The authors of fuzzydid are returning results in an unconventional way. Normally an estimation command uses ereturn post to return matrix e(b) and matrix e(V), which can than be used for postestimation.

    Here's a workaround to do this yourself.
    Code:
    local obs = e(N)
    mat b_temp = e(b_LATE)
    mat V_temp = e(se_LATE)
    
    mat b = J(1,1,.)
    mat V = J(1,1,.)
    mat b[1,1] = b_temp[1,1]
    mat V[1,1] = V_temp[1,1] * V_temp[1,1]
    mat rownames b = y1
    mat colnames b = DID
    mat rownames V = DID
    mat colnames V = DID
    
    ereturn post b V, obs(`obs')
    
    cap program drop add_cmd
    program add_cmd, eclass
        args cmd
        eret local cmd "`cmd'"
    end
    
    add_cmd "fuzzydid"
    
    estimates store fuzzy_results
    Edit : Normally the degrees of freedom are specified with ereturn post, but fuzzydid doesn't return this. Without degrees of freedom the standard normal distribution will be used so the p-values and confidence intervals etc. will be slightly off. This should't be a problem though if the sample size is large enough.
    Last edited by Wouter Wakker; 15 Dec 2020, 05:03.

    Comment


    • #3
      Dear Wouter,

      that worked perfectly. Thanks a lot.

      Best
      Marius

      Comment


      • #4
        Dear Wouter,
        I encountered another problem with this command and decided to post it here, as it is closely related to my previous issue, and may help others who eperience the same problem with the command.

        When trying to replay the results that I save using your suggested solution, I get a message saying "varlist required r(100);"

        Code:
        . estimates restore fuzzy_results
        (results fuzzy_resultsare active now)
        
        estimates replay fuzzy_results
        
        varlist required
        r(100);
        Also the fuzzydid command does not return the e(sample) function. Do you have an idea for a workaround here?

        Best
        Marius

        Comment


        • #5
          For estimates replay to work, the estimation command needs to be set up to allow replaying results. The authors of fuzzydid have not programmed this unfortunately. I don't think there is a way around this other than the authors revising the code to include this option,

          With regards to e(sample), I don't have the time to check what fuzzydid is doing internally but if it is just simple listwise deletion you could generate your own e(sample) variable with egen's rowmissing function combined with if and in statements. e(sample) is nothing more than an indicator variable with 1 for included observations and 0 otherwise.

          You could also contact the authors to see if they are willing to make some adjustments to the code. Returning e(sample) would be quite easy.

          Comment


          • #6
            Dear Wouter,

            again, thanks a lot for the quick reply and clarifying comment.

            Best
            Marius

            Comment

            Working...
            X