Announcement

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

  • eprobit: estat teffects doesn't work with labeled depvar [SOLVED]

    I am posting this mostly so others searching for this problem might find it.

    After estimating an extended probit regression (eprobit) with an endogenous treatment variable, then using
    Code:
    estat teffects, ate
    to get an estimate of the treatment effect, I got the following error:

    outlevel() incorrectly specified;
    must specify a value of F3D39,
    or #1, #2, ...
    r(111);


    (F3D39 is the dependent variable.) This is odd, since help erm estat says outlevel() is relevant only for eoprobit (ordered probit), not for eprobit.

    Codebook for F3D39 shows that it is indeed a binary variable:
    Code:
    . codebook F3D39 F3_FREQ_VOLUNTEER
    
    ------------------------------------------------------------------------------------------------------------------------------------------------
    F3D39                                                              Whether voted in any local/state/national election during 2009, 2010, or 2011
    ------------------------------------------------------------------------------------------------------------------------------------------------
    
                      type:  numeric (byte)
                     label:  F3D39
    
                     range:  [0,1]                        units:  1
             unique values:  2                        missing .:  0/10,532
    
                tabulation:  Freq.   Numeric  Label
                             6,315         0  No
                             4,217         1  Yes
    On a hunch, I created a new dependent variable based on the old:
    Code:
    . gen F3_VOTED_OTHER = F3D39
    
    . codebook F3_VOTED_OTHER
    
    ------------------------------------------------------------------------------------------------------------------------------------------------
    F3_VOTED_OTHER                                                                                                                       (unlabeled)
    ------------------------------------------------------------------------------------------------------------------------------------------------
    
                      type:  numeric (float)
    
                     range:  [0,1]                        units:  1
             unique values:  2                        missing .:  0/10,532
    
                tabulation:  Freq.  Value
                             6,315  0
                             4,217  1
    The results of eprobit are (of course) the same, but estat teffects now works:

    Code:
    . estat teffects, ate
    
    Predictive margins                              Number of obs     =      9,928
    
    ------------------------------------------------------------------------------
                 |             Linearized
                 |     Margin   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    ATE          |
    F3_BACHELORS |
       (1 vs 0)  |   .1073137   .0269087     3.99   0.000     .0544094    .1602181
    ------------------------------------------------------------------------------

  • #2
    I wouldn't consider the problem solved -- you have found a workaround but this sounds like a bug that should be fixed. You may want to notify Stata tech support about this.

    FYI, using example 3b for eprobit, I tried to replicate the problem, but couldn't. But perhaps I am doing something different than you were. Showing the actual eprobit command or a replicable example might help. Also make sure your version of Stata is up to date.

    Code:
    use http://www.stata-press.com/data/r15/class10, clear
    codebook graduate
    eprobit graduate income i.roommate, endogenous(hsgpa = income i.hscomp) entreat(program = i.campus i.scholar income, pocorrelation) vce(robust)
    estat teffects, ate
    -------------------------------------------
    Richard Williams, Notre Dame Dept of Sociology
    StataNow Version: 19.5 MP (2 processor)

    EMAIL: [email protected]
    WWW: https://www3.nd.edu/~rwilliam

    Comment


    • #3
      Thanks for your response. Interesting - I agree, the code you posted also works for me. Stata is indeed up to date (did an update all yesterday). Unfortunately I can't post data because these are restricted-use data under federal license, but here's the full code and log. Redacting the results due to license issues, but the results tables are identical including the header information (strata, PSUs, observations, population size, DF, F(), Prob > F).

      Code:
      . svy: eprobit F3D39 ib5.bypared_reduced ib4.byincome_reduced ib5.BYRACE_AP i.BYSEX i.F2D11_R i.F3A14A i.F3A14B i.F3A14C i.F3A14D i.F3A14E i.F3A
      > 14F, entreat(F3_BACHELORS = hs_gpa BYTXCSTD BYXTRACU_R ib5.BYRACE_AP i.BYSEX by_free_lunch i.BYGNSTAT i.BYSCTRL i.BYREGION i.BYSTLANG, nointer
      > act)
      (running eprobit on estimation sample)
      
      Survey: Extended probit regression
      
      ...
      
      . estat teffects, ate
      outlevel() incorrectly specified;
      must specify a value of F3D39,
      or #1, #2, ...
      r(111);
      
      . gen F3_VOTED_OTHER = F3D39
      
      . codebook F3_VOTED_OTHER
      
      ------------------------------------------------------------------------------------------------------------------------------------------------
      F3_VOTED_OTHER                                                                                                                       (unlabeled)
      ------------------------------------------------------------------------------------------------------------------------------------------------
      
                        type:  numeric (float)
      
                       range:  [0,1]                        units:  1
               unique values:  2                        missing .:  0/10,532
      
                  tabulation:  Freq.  Value
                               6,315  0
                               4,217  1
      
      . codebook F3D39
      
      ------------------------------------------------------------------------------------------------------------------------------------------------
      F3D39                                                              Whether voted in any local/state/national election during 2009, 2010, or 2011
      ------------------------------------------------------------------------------------------------------------------------------------------------
      
                        type:  numeric (byte)
                       label:  F3D39
      
                       range:  [0,1]                        units:  1
               unique values:  2                        missing .:  0/10,532
      
                  tabulation:  Freq.   Numeric  Label
                               6,315         0  No
                               4,217         1  Yes
      
      . svy: eprobit F3_VOTED_OTHER ib5.bypared_reduced ib4.byincome_reduced ib5.BYRACE_AP i.BYSEX i.F2D11_R i.F3A14A i.F3A14B i.F3A14C i.F3A14D i.F3A
      > 14E i.F3A14F, entreat(F3_BACHELORS = hs_gpa BYTXCSTD BYXTRACU_R ib5.BYRACE_AP i.BYSEX by_free_lunch i.BYGNSTAT i.BYSCTRL i.BYREGION i.BYSTLANG
      > , nointeract)
      (running eprobit on estimation sample)
      
      Survey: Extended probit regression
      
      ...
      
      . estat teffects, ate
      
      Predictive margins                              Number of obs     =      9,928
      
      ------------------------------------------------------------------------------
                   |             Linearized
                   |     Margin   Std. Err.      t    P>|t|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
      ATE          |
      F3_BACHELORS |
         (1 vs 0)  |   .1073137   .0269087     3.99   0.000     .0544094    .1602181
      ------------------------------------------------------------------------------

      Comment


      • #4
        You've got an svy: prefix, so maybe the problem is related to it. But I just tried to improvise an example and again couldn't replicate the problem:

        Code:
        use http://www.stata-press.com/data/r15/class10, clear
        codebook graduate
        svyset income
        svy: eprobit graduate income i.roommate, endogenous(hsgpa = income i.hscomp) entreat(program = i.campus i.scholar income, pocorrelation)
        estat teffects, ate
        A replicable example would be nice. But even if you can't provide one, I hope Stata will check this out. Maybe it is an esoteric error that only occurs under some conditions but it shouldn't happen at all.

        You might try changing the label for the variable, substituting something short. Maybe there is something about this specific label that causes teffects grief.
        -------------------------------------------
        Richard Williams, Notre Dame Dept of Sociology
        StataNow Version: 19.5 MP (2 processor)

        EMAIL: [email protected]
        WWW: https://www3.nd.edu/~rwilliam

        Comment

        Working...
        X