Announcement

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

  • Bug/overcorrection with post-Stata 14.1 margins command after ivprobit?

    Hello,
    I posted a few days ago with a question about a strange result I get with Stata 16 and ivprobit, using the margins, dydx() predict(pr) syntax to obtain predicted probabilities. Specifically, I find that my endogenous X1 variable, which had a negative coefficient in the ivprobit results, has a positive marginal effect. I saw in an older post (linked below) that Stata 14.1 instituted a fix, based on Skeels & Taylor (2015), which "includes the instrumented variable equation in the computation."

    My question is, is the "fix" producing a bug, or at least an overcorrection in certain cases, since it is apparently possible to have a marginal effect with the opposite sign from that of the estimated ivprobit coefficient? (If it is not a bug or an overcorrection, how does one report this strange result in a paper?)

    To illustrate, I am including/attaching the results of my ivprobit regression, using the margins command from Stata 16, and the results of the older margins command (using version control, Stata 14) for comparison. See how the ivprobit coefficient is negative, but the estimated probability change is positive. The sign of the probability change reverts to negative when I use the Stata 14 version of margins and predict.


    . ivprobit PROTBI (endogenous_X1=IV) X2 X3 X4 X5 X6 X7 X8 , vce(cluster orgId)

    Probit model with endogenous regressors Number of obs = 1,492
    Wald chi2(8) = 119.90
    Log pseudolikelihood = -1403.5646 Prob > chi2 = 0.0000

    (Std. Err. adjusted for 106 clusters in orgId)
    ------------------------------------------------------------------------------------------------
    | Robust
    | Coef. Std. Err. z P>|z| [95% Conf. Interval]
    ---------------------------------------------+----------------------------------------------------------------
    endogenous_X1 | -1.765481 .5107963 -3.46 0.001 -2.766624 -.7643387
    X2 | .2941948 .506894 0.58 0.562 -.6992993 1.287689
    X3 | .0003688 .0003185 1.16 0.247 -.0002554 .0009931
    X4 | .2330729 .1933046 1.21 0.228 -.1457971 .6119429
    X5 | .4271303 .198719 2.15 0.032 .0376481 .8166124
    X6 | .5621895 .2282728 2.46 0.014 .1147831 1.009596
    X7 | .2013893 .2776837 0.73 0.468 -.3428608 .7456393
    X8 | .4314645 .1971322 2.19 0.029 .0450925 .8178365
    _cons | -.15545 1.28781 -0.12 0.904 -2.679511 2.368611
    ----------------------------------------------+----------------------------------------------------------------
    corr(e.endogenous_X1,e.PROTBI)| .8989229 .1475742 -.040347 .9947866
    sd(e.endogenous_X1)| .4513452 .0497914 .3635852 .5602883
    ------------------------------------------------------------------------------------------------
    Instrumented: endogenous_X1
    Instruments: X2 X3 X4 X5 X6 X7 X8 IV
    ------------------------------------------------------------------------------------------------
    Wald test of exogeneity (corr = 0): chi2(1) = 3.64 Prob > chi2 = 0.0565


    . margins, dydx(endogenous_X1) predict(pr)

    Average marginal effects Number of obs = 1,492
    Model VCE : Robust

    Expression : Probability of positive outcome, predict(pr)
    dy/dx w.r.t. : endogenous_X1

    -------------------------------------------------------------------------------
    | Delta-method
    | dy/dx Std. Err. z P>|z| [95% Conf. Interval]
    ----------------------+----------------------------------------------------------------
    endogenous_X1 | .0908771 .1397807 0.65 0.516 -.1830882 .3648423
    -------------------------------------------------------------------------------


    . version 14: margins, dydx(endogenous_X1) predict(pr)

    Average marginal effects Number of obs = 1,492
    Model VCE : Robust

    Expression : Prob of positive outcome when rho=0, predict(pr)
    dy/dx w.r.t. : endogenous_X1

    -------------------------------------------------------------------------------
    | Delta-method
    | dy/dx Std. Err. z P>|z| [95% Conf. Interval]
    ----------------------+----------------------------------------------------------------
    endogenous_X1 | -.5541947 .2400751 -2.31 0.021 -1.024733 -.0836563
    -------------------------------------------------------------------------------


    References:
    Old post: https://www.statalist.org/forums/for...ivprobit-a-bug
    Skeels, C.L. and L.W. Taylor (2015) Prediction in linear index models with endogenous regressors, The Stata Journal (15), 627-644
    Attached Files

  • #2
    Apologies to revive this old thread, but this problem has apparently not been addressed on Statalist.

    What is the correct syntax to obtain marginal effects for the endogenous (instrumented) variable using ivprobit starting with Stata 14.1?

    As Joe rightly showed above, it is not to use "margins, dydx(endogenous_X1) predict(pr)", which (nonsensically) controls for the instrument ("IV") when calculating marginal effects.

    Any pointer would be much appreciated.

    Comment


    • #3
      Hello Dear All,

      Instead of opening a new thread, I would like to post here. I have been experiencing the same problem. Is there any update or idea why we may experience this problem?

      Thank you
      Alper


      Comment


      • #4
        Alper and Karsten,
        Sorry I'm just seeing your posts now. I was not able to find an answer as to why the sign of the margin is different from the sign of the ivprobit coefficient. I believe that is a bug in the way Stata calculates margins in versions 14.1 and above. I was able to solve the problem by using Stata's version control and specifying version 14.0

        The syntax is: version 14.0: margins, dydx(varlist) predict(pr)

        Using the version 14.0 margins command, all of the margins' signs are consistent with the ivprobit coefficients' signs. I hope this is useful to you.

        Joe

        Comment


        • #5
          Joe: Have you done the calculation “by hand” so see whether it’s correct in Stata 14? I’ll give it a go when I have a chance.

          Comment


          • #6
            Dear Joe,

            If you want, we will look at your data and code to verify what is happening. If possible, send your code and data to [email protected]. On the mean time, let me explain what the differences are between the two computations.

            Following the methods and formulas from the manual, the probabilities implied by the model are given by:

            $$ P\left(y_1 = 1| y_2, z\right) = \Phi \left[\frac{z_i\delta +\rho \left(y_{2i}- x_i\pi\right)/\sigma}{\left(1-\rho^2\right)^{1/2}} \right]$$

            Before Stata 14 this probability was calculated using only \(z_i\delta\). After Stata 14 all the terms in parenthesis are used in the computation. From the expression above, you can see that the computed probabilities and effects may differ. This happens regardless of the sign of the coefficients.
            Last edited by Enrique Pinzon (StataCorp); 26 Jun 2020, 16:16.

            Comment


            • #7
              Enrique: Thank you for your reply. I am happy to send my data and .do file and will do so today.

              Jeff: Thank you for your reply as well. To be honest, I haven't done these calculations by hand before. Is there an online resource where I can find the formulas/commands? (COVID has locked me out of my office.) Please let me know if you would like me to share my data and .do file. I'm happy to send them.

              Comment


              • #8
                Hello Joe,

                https://www.stata.com/manuals/rivprobit.pdf

                In this entry and the postestimation entry (you can get to postestimation using the link in the 'Also see' section), you can see what we are doing. The calculations are based on the normal c.d.f. The effects calculated by -margins- are numerical derivatives of the c.d.f. The closed form derivative you obtain using the formula should be 'almost' the same.

                Comment


                • #9
                  Enrique and Jeff,
                  I have done a "hand" calculation of the AMEs for my ivprobit model, using the formula for the current margins command and the Version 14 margins command. (The resources I consulted are here and here.) My output is contained in the attached log file. The file starts by showing the original ivprobit output, the AMEs for X1, and the predicted probabilities of Y at specific values of X1.

                  I was able to replicate the results of both versions of margins. So unless I have misinterpreted what you meant by hand calculation, the issue must be with the formulas themselves. Is the current formula used to calculate margins more correct than the formula used in Version 14? If so, how can a negative (and significant) probit coefficient give positive marginal effects, both as AMEs and as predicted probabilities that increase at higher values of X1?

                  I have sent my data set and .do file to tech-support, as you requested, Enrique.

                  Thank you both,
                  Joe
                  Attached Files

                  Comment


                  • #10
                    Dear Joe,

                    Thanks for sending the data and code to us. The reason why the sign of the coefficient and the sign of the predicted effects might be different is that the endogenous variables appears in two terms in the expression below:

                    $$ P\left(y_1 = 1| y_2, z, x\right) = \Phi \left[\frac{z_i\delta +\rho \left(y_{2i}- x_i\pi\right)/\sigma}{\left(1-\rho^2\right)^{1/2}} \right]$$

                    It appears in \(z_i\delta\) and it appears in \(\rho \left(y_{2i}- x_i\pi\right)/\sigma\). If the endogenous variable only appeared in \(z_i\delta\) your intuition would be correct.
                    If you were to condition on \(y_2, z, x,\) and on \(\nu \ \equiv (y_{2i}- x_i) \) then the sign would not change. If you wanted to condition on \(\nu\) you could use margins with the
                    -expression()- option.

                    Comment


                    • #11
                      Joe, Enrique: That formula on which the partial effects are computed is incorrect. This is tantamount, in the linear case, to compute the effect of y2 as E(y1|y2,x). If we could do that, there'd be no reason to actually have instruments. We could just estimate

                      The derivative should only be with respect to the occurrence of y2 in z. The part (y2 - x*pi) is the so-called control function, and it should be held fixed. I'm not sure why this is used in the full MLE, anyway, as the proper APEs are obtained by dropping the CF term in the expression above. I show this in my 2010 MIT Press book. If you do leave the CF in, then it gets averaged out. You don't take the derivative of y2 in the CF.

                      When I have a bit more time, I'll find an example and post.

                      Jeff

                      Comment


                      • #12
                        Thank you, Jeff. This is very helpful!
                        I look forward to seeing your example when you have time to post.

                        Best wishes,
                        Joe

                        Comment


                        • #13
                          I confirmed that Stata is not computing the APEs correctly. I don't know whether the calculations were correct prior to Stata 14, but I used them in my course slides and got similar answers to my two-step "by hand" calculations. In any case, the current calculations are not correct. Prediction is not the same as computing causal effects -- an obvious point, I know, but one that seemed to slip past the Stata people. I'm not sure that Skeels and Taylor (2015) were suggesting changing the marginal effect calculations but it seemed to have that effect.

                          In any case, it is easy to do the "by hand" calculation using the two-step method. (Stata doesn't allow the marginal effect calculation in the two-step method, something that I also hope is corrected in the next version.)

                          Here is the example that I use for one of my classes. It confirms that the two-step estimates that ivprobit reports and that I compute are identical. The APE calculation is then simple. What is not so simple is getting a standard error. I would put the two-steps (first stage by OLS, second by probit) in a little bootstrap program and resample 1,000 times or so. This will give a good standard error.

                          Code:
                          . ivprobit inlf educ c.exper c.exper#c.exper age kidslt6 kidsge6 ///
                          >         (nwifeinc = huseduc), first
                          
                          Fitting exogenous probit model
                          
                          Iteration 0:   log likelihood =  -514.8732  
                          Iteration 1:   log likelihood = -401.13728  
                          Iteration 2:   log likelihood = -400.30361  
                          Iteration 3:   log likelihood = -400.30301  
                          Iteration 4:   log likelihood = -400.30301  
                          
                          Fitting full model
                          
                          Iteration 0:   log likelihood = -3230.6635  
                          Iteration 1:   log likelihood = -3230.6421  
                          Iteration 2:   log likelihood = -3230.6421  
                          
                          Probit model with endogenous regressors         Number of obs     =        753
                                                                          Wald chi2(7)      =     200.50
                          Log likelihood = -3230.6421                     Prob > chi2       =     0.0000
                          
                          -----------------------------------------------------------------------------------------
                                                  |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                          ------------------------+----------------------------------------------------------------
                          inlf                    |
                                         nwifeinc |  -.0355243   .0161904    -2.19   0.028    -.0672569   -.0037916
                                             educ |   .1640289   .0312249     5.25   0.000     .1028293    .2252285
                                            exper |    .112085   .0211991     5.29   0.000     .0705356    .1536344
                                                  |
                                  c.exper#c.exper |  -.0018751   .0005915    -3.17   0.002    -.0030345   -.0007158
                                                  |
                                              age |  -.0433193   .0113314    -3.82   0.000    -.0655284   -.0211101
                                          kidslt6 |  -.8137458   .1299442    -6.26   0.000    -1.068432   -.5590599
                                          kidsge6 |   .0460536   .0431386     1.07   0.286    -.0384966    .1306037
                                            _cons |   .0164965   .5300821     0.03   0.975    -1.022445    1.055438
                          ------------------------+----------------------------------------------------------------
                          nwifeinc                |
                                             educ |   .6746951   .2125447     3.17   0.002     .2581151    1.091275
                                            exper |  -.3129877   .1375186    -2.28   0.023    -.5825191   -.0434563
                                                  |
                                  c.exper#c.exper |  -.0004776   .0044955    -0.11   0.915    -.0092885    .0083334
                                                  |
                                              age |   .3401521   .0593903     5.73   0.000     .2237492     .456555
                                          kidslt6 |   .8262719   .8140196     1.02   0.310    -.7691772    2.421721
                                          kidsge6 |   .4355289   .3202738     1.36   0.174    -.1921962    1.063254
                                          huseduc |   1.178155   .1600877     7.36   0.000      .864389    1.491921
                                            _cons |  -14.72048   3.767154    -3.91   0.000    -22.10397   -7.336999
                          ------------------------+----------------------------------------------------------------
                                       /athrho2_1 |   .2737896   .1929615     1.42   0.156    -.1044081    .6519873
                                        /lnsigma2 |   2.339812   .0257684    90.80   0.000     2.289307    2.390317
                          ------------------------+----------------------------------------------------------------
                           corr(e.nwifeinc,e.inlf)|   .2671475   .1791903                     -.1040303    .5730063
                                    sd(e.nwifeinc)|   10.37928   .2674576                      9.868095    10.91695
                          -----------------------------------------------------------------------------------------
                          Instrumented:  nwifeinc
                          Instruments:   educ exper c.exper#c.exper age kidslt6 kidsge6 huseduc
                          -----------------------------------------------------------------------------------------
                          Wald test of exogeneity (corr = 0): chi2(1) = 2.01        Prob > chi2 = 0.1559
                          
                          . 
                          . * Following is incorrect starting with Stata 14:
                          .         
                          . margins, predict(pr) dydx(*)
                          
                          Average marginal effects                        Number of obs     =        753
                          Model VCE    : OIM
                          
                          Expression   : Probability of positive outcome, predict(pr)
                          dy/dx w.r.t. : nwifeinc educ exper age kidslt6 kidsge6 huseduc
                          
                          ------------------------------------------------------------------------------
                                       |            Delta-method
                                       |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
                          -------------+----------------------------------------------------------------
                              nwifeinc |   -.003046   .0050727    -0.60   0.548    -.0129882    .0068962
                                  educ |   .0456518   .0095799     4.77   0.000     .0268755    .0644281
                                 exper |   .0256561   .0034917     7.35   0.000     .0188124    .0324997
                                   age |  -.0162091   .0032176    -5.04   0.000    -.0225156   -.0099027
                               kidslt6 |  -.2599143    .035065    -7.41   0.000    -.3286404   -.1911881
                               kidsge6 |   .0108458   .0131829     0.82   0.411    -.0149922    .0366838
                               huseduc |  -.0094389   .0012977    -7.27   0.000    -.0119824   -.0068955
                          ------------------------------------------------------------------------------
                          
                          . 
                          . * Could fill in the by hand calculation based on parameters. See
                          . * Wooldridge (2010, p. 586).
                          . 
                          . ivprobit inlf educ c.exper c.exper#c.exper age kidslt6 kidsge6 ///
                          >         (nwifeinc = huseduc), twostep
                          Checking reduced-form model...
                          
                          Two-step probit with endogenous regressors        Number of obs   =        753
                                                                            Wald chi2(7)    =     173.79
                                                                            Prob > chi2     =     0.0000
                          
                          ---------------------------------------------------------------------------------
                                          |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                          ----------------+----------------------------------------------------------------
                                 nwifeinc |  -.0368641   .0186314    -1.98   0.048    -.0733809   -.0003472
                                     educ |   .1702153   .0384014     4.43   0.000     .0949499    .2454806
                                    exper |   .1163123   .0197084     5.90   0.000     .0776846      .15494
                                          |
                          c.exper#c.exper |  -.0019459   .0006129    -3.17   0.001    -.0031471   -.0007446
                                          |
                                      age |   -.044953    .010327    -4.35   0.000    -.0651936   -.0247125
                                  kidslt6 |  -.8444363   .1218529    -6.93   0.000    -1.083264    -.605609
                                  kidsge6 |   .0477905    .045177     1.06   0.290    -.0407549    .1363359
                                    _cons |   .0171187   .5498911     0.03   0.975    -1.060648    1.094885
                          ---------------------------------------------------------------------------------
                          Instrumented:  nwifeinc
                          Instruments:   educ exper c.exper#c.exper age kidslt6 kidsge6 huseduc
                          ---------------------------------------------------------------------------------
                          Wald test of exogeneity: chi2(1) = 1.99                   Prob > chi2 = 0.1584
                          
                          .         
                          . * Unfortunately, the two-step option does not compute the APE.
                          . 
                          . * Do two-step by hand. Standard errors need to be corrected.
                          . * Putting both steps in a bootstrap routine is easy.
                          . * See Wooldridge (2010, top of page 589).
                          . 
                          . reg nwifeinc huseduc educ c.exper c.exper#c.exper age kidslt6 kidsge6
                          
                                Source |       SS           df       MS      Number of obs   =       753
                          -------------+----------------------------------   F(7, 745)       =     27.13
                                 Model |  20676.7705         7  2953.82436   Prob > F        =    0.0000
                              Residual |  81120.3451       745  108.886369   R-squared       =    0.2031
                          -------------+----------------------------------   Adj R-squared   =    0.1956
                                 Total |  101797.116       752  135.368505   Root MSE        =    10.435
                          
                          ---------------------------------------------------------------------------------
                                 nwifeinc |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                          ----------------+----------------------------------------------------------------
                                  huseduc |   1.178155   .1609449     7.32   0.000     .8621956    1.494115
                                     educ |   .6746951   .2136829     3.16   0.002     .2552029    1.094187
                                    exper |  -.3129877   .1382549    -2.26   0.024    -.5844034   -.0415721
                                          |
                          c.exper#c.exper |  -.0004776   .0045196    -0.11   0.916    -.0093501     .008395
                                          |
                                      age |   .3401521   .0597084     5.70   0.000     .2229354    .4573687
                                  kidslt6 |   .8262719   .8183785     1.01   0.313    -.7803305    2.432874
                                  kidsge6 |   .4355289   .3219888     1.35   0.177    -.1965845    1.067642
                                    _cons |  -14.72048   3.787326    -3.89   0.000    -22.15559   -7.285383
                          ---------------------------------------------------------------------------------
                          
                          . predict v2hat, resid
                          
                          . probit inlf nwifeinc educ c.exper c.exper#c.exper age kidslt6 kidsge6 v2hat
                          
                          Iteration 0:   log likelihood =  -514.8732  
                          Iteration 1:   log likelihood = -401.13728  
                          Iteration 2:   log likelihood = -400.30361  
                          Iteration 3:   log likelihood = -400.30301  
                          Iteration 4:   log likelihood = -400.30301  
                          
                          Probit regression                               Number of obs     =        753
                                                                          LR chi2(8)        =     229.14
                                                                          Prob > chi2       =     0.0000
                          Log likelihood = -400.30301                     Pseudo R2         =     0.2225
                          
                          ---------------------------------------------------------------------------------
                                     inlf |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                          ----------------+----------------------------------------------------------------
                                 nwifeinc |  -.0368641   .0182706    -2.02   0.044    -.0726738   -.0010543
                                     educ |   .1702153   .0376718     4.52   0.000     .0963798    .2440507
                                    exper |   .1163123   .0193312     6.02   0.000     .0784239    .1542007
                                          |
                          c.exper#c.exper |  -.0019459   .0006009    -3.24   0.001    -.0031235   -.0007682
                                          |
                                      age |   -.044953   .0101367    -4.43   0.000    -.0648206   -.0250855
                                  kidslt6 |  -.8444363   .1198154    -7.05   0.000     -1.07927   -.6096025
                                  kidsge6 |   .0477905   .0443204     1.08   0.281    -.0390758    .1346568
                                    v2hat |   .0267093   .0189352     1.41   0.158    -.0104031    .0638217
                                    _cons |   .0171187   .5392914     0.03   0.975    -1.039873     1.07411
                          ---------------------------------------------------------------------------------
                          
                          . margins, dydx(nwifeinc)
                          
                          Average marginal effects                        Number of obs     =        753
                          Model VCE    : OIM
                          
                          Expression   : Pr(inlf), predict()
                          dy/dx w.r.t. : nwifeinc
                          
                          ------------------------------------------------------------------------------
                                       |            Delta-method
                                       |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
                          -------------+----------------------------------------------------------------
                              nwifeinc |  -.0110576   .0054418    -2.03   0.042    -.0217234   -.0003918
                          ------------------------------------------------------------------------------

                          Comment


                          • #14
                            Dear Jeff and Joe,


                            Just for clarity, the predicted probability formula is correct. What Jeff
                            refers to is the computation of effects based on that formula.

                            Calculating average partial effects based on this probability formula gives a
                            statistic that does not have an average structural function interpretation,
                            because we are perturbing both observables and unobservables. What Jeff wants,
                            and is more useful to ask questions about counterfactuals, is to integrate over
                            the unobservables and then compute average partial effects.

                            You can get the predictions Jeff and Joe want using -eprobit-. We are working
                            on adding these predictions to -ivprobit-, it is in a beta version that is in
                            your code currently but not documented. -eprobit- gives you equivalent point
                            estimates to ivprobit but allows you more postestimation options. -margins-
                            after -eprobit- computes an average structural function and allows you other
                            options to handle the unobservable components. It also allows for multiple
                            endogenous equations with different instruments. Here is a simulated data
                            example of how to get the effects for the average structural function.

                            Code:
                            . clear
                            
                            . set seed 123
                            
                            . set obs 5000
                            number of observations (_N) was 0, now 5,000
                            
                            . gen id  = _n
                            
                            . mat cov = (1,-0.5\-0.5,4)
                            
                            . drawnorm e1 e2, cov(cov)
                            
                            . gen x1  = runiform()
                            
                            . gen x2  = runiform()
                            
                            . gen z1  = runiform()
                            
                            . gen z2  = runiform()
                            
                            . gen zb  = 1 + z1 + z2
                            
                            . gen y2  = zb + e2
                            
                            . gen xb  = -1.5 + x1 + x2 + 0.75*y2
                            
                            . gen y1  = (xb + e1) > 0
                            
                            . eprobit y1 x1 x2, endog(y2 = x1 x2 z1 z2)
                            
                            Iteration 0:   log likelihood = -12274.567  
                            Iteration 1:   log likelihood = -12274.567  
                            
                            Extended probit regression                      Number of obs     =      5,000
                                                                            Wald chi2(3)      =     592.69
                            Log likelihood = -12274.567                     Prob > chi2       =     0.0000
                            
                            ---------------------------------------------------------------------------------
                                            |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                            ----------------+----------------------------------------------------------------
                            y1              |
                                         x1 |   1.044111   .0887834    11.76   0.000     .8700984    1.218123
                                         x2 |   1.040255   .0890415    11.68   0.000     .8657372    1.214774
                                         y2 |   .7476604   .0497003    15.04   0.000     .6502497    .8450712
                                      _cons |  -1.525274   .1211866   -12.59   0.000    -1.762796   -1.287753
                            ----------------+----------------------------------------------------------------
                            y2              |
                                         x1 |  -.0647558    .097615    -0.66   0.507    -.2560777    .1265662
                                         x2 |  -.1312252   .0986173    -1.33   0.183    -.3245114    .0620611
                                         z1 |   .8950109   .0980193     9.13   0.000     .7028967    1.087125
                                         z2 |    .857016   .0985302     8.70   0.000     .6639004    1.050132
                                      _cons |   1.213411   .1019993    11.90   0.000     1.013496    1.413326
                            ----------------+----------------------------------------------------------------
                                   var(e.y2)|    3.98964   .0797928                      3.836274    4.149137
                            ----------------+----------------------------------------------------------------
                             corr(e.y2,e.y1)|  -.2022677   .1319464    -1.53   0.125    -.4420192    .0644564
                            ---------------------------------------------------------------------------------
                            
                            . margins, dydx(y2) predict(pr fix(y2))
                            
                            Average marginal effects                        Number of obs     =      5,000
                            Model VCE    : OIM
                            
                            Expression   : Pr(y1==1), predict(pr fix(y2))
                            dy/dx w.r.t. : y2
                            
                            ------------------------------------------------------------------------------
                                         |            Delta-method
                                         |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
                            -------------+----------------------------------------------------------------
                                      y2 |   .1371811   .0057121    24.02   0.000     .1259857    .1483766
                            ------------------------------------------------------------------------------
                            This quantity has an average structural function interpretation. -margins- is
                            integrating over the distribution of the unobservable.

                            In the current version of -ivprobit- you would type:

                            Code:
                            . ivprobit y1 x1 x2 (y2 = z1 z2)
                            
                            Fitting exogenous probit model
                            
                            Iteration 0:   log likelihood = -2946.6422  
                            Iteration 1:   log likelihood = -1784.0064  
                            Iteration 2:   log likelihood = -1721.2204  
                            Iteration 3:   log likelihood = -1720.6217  
                            Iteration 4:   log likelihood = -1720.6216  
                            
                            Fitting full model
                            
                            Iteration 0:   log likelihood = -12274.568  
                            Iteration 1:   log likelihood = -12274.567  
                            Iteration 2:   log likelihood = -12274.567  
                            
                            Probit model with endogenous regressors         Number of obs     =      5,000
                                                                            Wald chi2(3)      =     592.69
                            Log likelihood = -12274.567                     Prob > chi2       =     0.0000
                            
                            ---------------------------------------------------------------------------------
                                            |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                            ----------------+----------------------------------------------------------------
                                         y2 |   .7476604   .0497003    15.04   0.000     .6502496    .8450712
                                         x1 |   1.044111   .0887834    11.76   0.000     .8700984    1.218123
                                         x2 |   1.040255   .0890415    11.68   0.000     .8657372    1.214774
                                      _cons |  -1.525274   .1211866   -12.59   0.000    -1.762796   -1.287753
                            ----------------+----------------------------------------------------------------
                             corr(e.y2,e.y1)|  -.2022676   .1319464                     -.4420192    .0644565
                                    sd(e.y2)|   1.997408   .0199741                      1.958641    2.036943
                            ---------------------------------------------------------------------------------
                            Instrumented:  y2
                            Instruments:   x1 x2 z1 z2
                            ---------------------------------------------------------------------------------
                            Wald test of exogeneity (corr = 0): chi2(1) = 2.22        Prob > chi2 = 0.1360
                            
                            . margins, dydx(y2) predict(pr fix(y2))
                            
                            Average marginal effects                        Number of obs     =      5,000
                            Model VCE    : OIM
                            
                            Expression   : Probability of positive outcome, predict(pr fix(y2))
                            dy/dx w.r.t. : y2
                            
                            ------------------------------------------------------------------------------
                                         |            Delta-method
                                         |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
                            -------------+----------------------------------------------------------------
                                      y2 |   .1371811   .0057121    24.02   0.000     .1259856    .1483766
                            ------------------------------------------------------------------------------
                            The syntax for the estimation may change but the option is currently there.
                            Joe, thanks again for the data and inquiries. We are working in adding more
                            predictions to -ivprobit-. Thanks to Jeff too.
                            Last edited by Enrique Pinzon (StataCorp); 02 Jul 2020, 14:47.

                            Comment


                            • #15
                              Jeff and Enrique,
                              Thank you both for your very detailed responses on this thread. I've found them very helpful and I'm sure other Statalist-ers will too.

                              Best wishes,
                              Joe

                              Comment

                              Working...
                              X