Announcement

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

  • Logit option in teffects outcome model returns r322 error unexpectedly

    Hello,

    Prior to today, the below code ran fine. This morning I ran some updates, and am now running into the same error, which disappears when logit is removed (i.e. a linear outcome model)

    Code:
    . teffects ipwra (nllonely $xlist, logit)           ///
    >                            ($treatment $xlist pnq3), vce(robust)        
    outcome model: perfect predictions detected; the model, as specified, is not identified
        1.source#1.singleparent != 0 (n=7) predicts failure perfectly
        1.source#1.otherhhtype != 0 (n=2) predicts failure perfectly
        1.source#c.dseifa4 != 0 (n=13) predicts failure perfectly
        1.source#c.dseifa8 != 0 (n=10) predicts failure perfectly
        1.source#c.dseifa9 != 0 (n=25) predicts failure perfectly

    I don't really understand why this is the case.. does anyone know of a work around (noting "asis" option in logit will not run within teffects)?

    Many thanks,
    Hannah

  • #2
    Hi all,

    Just want to clarify that my covariates are not interacted:
    Code:
    global xlist "male dagecat2 dagecat3 dagecat4 dagecat5 dagecat6 fulltime parttime unemployed postgrad cert someuni livesalone couplewdeps singleparent houseshare otherhhtype $seifa"
    Therefore I don't think I should be receiving the error with interacted variables?

    Also, the logit outcome model is running fine separately:
    Code:
    logit nllonely $xlist
    
    Iteration 0:  Log likelihood = -2449.0117  
    Iteration 1:  Log likelihood =  -2397.881  
    Iteration 2:  Log likelihood =  -2394.827  
    Iteration 3:  Log likelihood = -2394.8159  
    Iteration 4:  Log likelihood = -2394.8159  
    
    Logistic regression                                     Number of obs =  8,011
                                                            LR chi2(26)   = 108.39
                                                            Prob > chi2   = 0.0000
    Log likelihood = -2394.8159                             Pseudo R2     = 0.0221
    
    ------------------------------------------------------------------------------
        nllonely | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
    -------------+----------------------------------------------------------------
            male |    -.04833   .0830371    -0.58   0.561    -.2110797    .1144196
        dagecat2 |  -.1936724    .135027    -1.43   0.151    -.4583205    .0709757
        dagecat3 |  -.1880247   .1385637    -1.36   0.175    -.4596047    .0835552
        dagecat4 |  -.2746864   .1330054    -2.07   0.039    -.5353722   -.0140006
        dagecat5 |  -.2550917   .1461777    -1.75   0.081    -.5415947    .0314112
        dagecat6 |   -.345141   .1604027    -2.15   0.031    -.6595245   -.0307575
        fulltime |  -.3730588   .1165145    -3.20   0.001     -.601423   -.1446945
        parttime |  -.0995582   .1192863    -0.83   0.404    -.3333551    .1342387
      unemployed |   .2794165   .2121323     1.32   0.188    -.1363553    .6951882
        postgrad |  -.6269923   .2150008    -2.92   0.004    -1.048386   -.2055986
            cert |    .087169   .0946687     0.92   0.357    -.0983782    .2727163
         someuni |   .0057425   .1117026     0.05   0.959    -.2131905    .2246755
      livesalone |    .480646   .1101299     4.36   0.000     .2647954    .6964966
     couplewdeps |   .0763031   .1141998     0.67   0.504    -.1475245    .3001306
    singleparent |   .5657626   .1434381     3.94   0.000     .2846291    .8468961
      houseshare |  -.1859757   .4008341    -0.46   0.643    -.9715962    .5996447
     otherhhtype |   .2334798   .2010009     1.16   0.245    -.1604747    .6274344
         dseifa1 |   .3739698   .1795043     2.08   0.037     .0221479    .7257918
         dseifa2 |   .3077496   .1743917     1.76   0.078    -.0340519    .6495511
         dseifa3 |   .1942783   .1747092     1.11   0.266    -.1481453     .536702
         dseifa4 |    .123598   .1834911     0.67   0.501    -.2360378    .4832339
         dseifa5 |  -.0943419   .1978045    -0.48   0.633    -.4820315    .2933478
         dseifa6 |   .0362833   .1829781     0.20   0.843    -.3223473    .3949138
         dseifa7 |   .1445419   .1816156     0.80   0.426    -.2114181     .500502
         dseifa8 |   .0703278   .1845394     0.38   0.703    -.2913627    .4320183
         dseifa9 |  -.1868921   .1972172    -0.95   0.343    -.5734306    .1996465
           _cons |  -2.181734   .1964907   -11.10   0.000    -2.566849   -1.796619
    Therefore, suspect it may have something to do with a teffects ipwra update?

    Perhaps related to the update 10may2022 entry:
    13. predict after logit and probit, when a double-precision variable was omitted because of perfect prediction,
    could return missing values for observations where it should not have been missing. This has been fixed.
    Can anyone reassure either way whether my initial results were valid? They are below (apologies for screenshot could no longer C+P the code):

    Click image for larger version

Name:	BC_result.png
Views:	1
Size:	63.3 KB
ID:	1753235


    Any wisdom at all is greatly appreciated.

    Kind regards,
    Hannah

    Comment


    • #3
      Hi again,

      FYI - I’ve had a response from Stata in relation to this…“This relates to one of our previous bugs that happened when collinear predictors exist in the model. The old behavior reported incorrect results. This has been fixed and an error message will be given in this scenario.”

      Relevant update from 04oct2022: teffects with an outcome or treatment model logit, probit, or hetprobit that contained perfect predictors either reported incorrect estimates or did not converge. teffects now issues an error if perfect predictors occur in either the treatment or the outcome model. A warning is issued for the outcome model if completely determined outcomes are detected.

      Kind regards,
      Hannah
      Last edited by Hannah Beilby; 15 May 2024, 17:16.

      Comment

      Working...
      X