Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: dprobit and lincom


From   jpitblado@stata.com (Jeff Pitblado, StataCorp LP)
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: dprobit and lincom
Date   Fri, 22 Jan 2010 10:03:43 -0600

Melanee Thomas <melanee.thomas@mail.mcgill.ca> asks how to get -lincom- to
work with the values reported in the output from -dprobit-:

> I have a question about dprobit and lincom. Specifically, when I run lincom
> after dprobit, the returned coefficient is a probit coefficient, rather than
> the dF/dx reported by dprobit. Is there an option I can use to transform the
> probit coefficient returned by lincom to the dF/dx reported by dprobit?

Maarten Buis <maartenbuis@yahoo.co.uk> replied mentioning -mfx- for Stata 10
users and the new -margins- command in Stata 11.

Austin Nichols <austinnichols@gmail.com> replied with some substative advice
and a couple examples involving data manipulation.

Maarten then replied with his own example using -probit-, -summarize-, and
-nlcom-.

I'll just comment the use of -lincom- after -mfx- and -margins-.

While -mfx- does compute marginal effects, it does not provide an easy way of
posting its results so that -lincom- will work with the marginal effects.

The -margins- command computes marginal effects and has an option that will
allow -lincom- to work with the resulting marginal effects.

Here is a brief example of how this can be done.

First we'll establish that -margins- can reproduce the marginal effects from
-dprobit-.

Using the auto data, we'll use -dprobit- to fit a probit regression of the
'foreign' indicator variable on 3 predictors.  -dprobit- reports the marginal
effects at the overall mean of the 3 predictors.

	. sysuse auto
	. dprobit for mpg turn trunk, nolog

Next we'll refit the model using -probit-, and use the -margins- command to
reproduce the marginal effect calculations.

	. probit for mpg turn trunk, nolog
	. margins, dydx(*) atmeans

Here is what Stata reported:

***** BEGIN:
. sysuse auto
(1978 Automobile Data)

. dprobit for mpg turn trunk, nolog

Probit regression, reporting marginal effects           Number of obs =     74
                                                        LR chi2(3)    =  38.76
                                                        Prob > chi2   = 0.0000
Log likelihood = -25.652611                             Pseudo R2     = 0.4304

------------------------------------------------------------------------------
 foreign |      dF/dx   Std. Err.      z    P>|z|     x-bar  [    95% C.I.   ]
---------+--------------------------------------------------------------------
     mpg |  -.0089624   .0094573    -0.96   0.337   21.2973  -.027498  .009574
    turn |  -.0755808   .0188995    -4.28   0.000   39.6486  -.112623 -.038538
   trunk |  -.0062585   .0137758    -0.45   0.654   13.7568  -.033259  .020742
---------+--------------------------------------------------------------------
  obs. P |   .2972973
 pred. P |   .1438596  (at x-bar)
------------------------------------------------------------------------------
    z and P>|z| correspond to the test of the underlying coefficient being 0

. probit for mpg turn trunk, nolog

Probit regression                                 Number of obs   =         74
                                                  LR chi2(3)      =      38.76
                                                  Prob > chi2     =     0.0000
Log likelihood = -25.652611                       Pseudo R2       =     0.4304

------------------------------------------------------------------------------
     foreign |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         mpg |  -.0395317   .0411346    -0.96   0.337    -.1201541    .0410907
        turn |  -.3333765   .0779801    -4.28   0.000    -.4862148   -.1805383
       trunk |  -.0276053   .0616797    -0.45   0.654    -.1484953    .0932847
       _cons |   13.37647   3.500776     3.82   0.000     6.515074    20.23786
------------------------------------------------------------------------------

. margins, dydx(*) atmeans

Conditional marginal effects                      Number of obs   =         74
Model VCE    : OIM

Expression   : Pr(foreign), predict()
dy/dx w.r.t. : mpg turn trunk
at           : mpg             =     21.2973 (mean)
               turn            =    39.64865 (mean)
               trunk           =    13.75676 (mean)

------------------------------------------------------------------------------
             |            Delta-method
             |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         mpg |  -.0089624   .0094573    -0.95   0.343    -.0274982    .0095735
        turn |  -.0755808   .0188995    -4.00   0.000    -.1126232   -.0385385
       trunk |  -.0062585   .0137758    -0.45   0.650    -.0332586    .0207416
------------------------------------------------------------------------------
***** END:

Now that we've established that -margins- can reproduce the marginal effects
reported by -dprobit-, all we need is to use -margins-' -post- option to post
the marginal effects and their covariances to -e(b)- and -e(V)- so that we can
use -lincom- with them.

	. margins, dydx(*) atmeans post
	. lincom mpg - turn

Here is what Stata reports:

***** BEGIN:
. margins, dydx(*) atmeans post

Conditional marginal effects                      Number of obs   =         74
Model VCE    : OIM

Expression   : Pr(foreign), predict()
dy/dx w.r.t. : mpg turn trunk
at           : mpg             =     21.2973 (mean)
               turn            =    39.64865 (mean)
               trunk           =    13.75676 (mean)

------------------------------------------------------------------------------
             |            Delta-method
             |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         mpg |  -.0089624   .0094573    -0.95   0.343    -.0274982    .0095735
        turn |  -.0755808   .0188995    -4.00   0.000    -.1126232   -.0385385
       trunk |  -.0062585   .0137758    -0.45   0.650    -.0332586    .0207416
------------------------------------------------------------------------------

. lincom mpg - turn

 ( 1)  mpg - turn = 0

------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   .0666185   .0163695     4.07   0.000     .0345348    .0987022
------------------------------------------------------------------------------
***** END:

The output from -lincom- is the difference between the conditional marginal
effects of 'mpg' and 'turn'.

--Jeff
jpitblado@stata.com
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index