Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

Re: st: conditional marginal effects after the Heckman two-step sample

From (Vince Wiggins, StataCorp)
Subject   Re: st: conditional marginal effects after the Heckman two-step sample
Date   Thu, 30 Dec 2010 14:04:53 -0600

Norbert Wilson <> is having trouble getting -margins- to
estimate the marginal effect of a covariate on the conditional expectation of
his dependent variable -- E(y | y observed) -- after estimation using
-heckman- with the -twostep- option.  Norbert writes that he is typing,

    . margins, dydx (x) predict (ycond)

and that Stata "does not recognize this command".  Norbert also notes that he
was able to obtain estimates of these marginal effects using -mfx-.

I am not sure what "does not recognized" means, but I can see two possible
problems.  One,  Norbert's command is not technically legal.  He should remove
the spaces between his option names and their associated open parentheses, 

    . margins, dydx(x) predict(ycond)

I say technically, because sometimes Stata will tolerate these spaces and
sometimes it will not.  Either way, they are not supported.

Two, and more likely, -margins- is returning the following error after
Norbert's command, 

    predict option ycond not appropriate with margins

Had Norbert fit his Heckman model using the default MLE, -margins- would have
been willing to estimated the marginal effects.  

The reason it refuses after twostep estimation is that estimates of sigma (the
root of the variance of the disturbances) and rho (the correlation between the
disturbances of the model and selection equations) are required estimate the
conditional expectations of the dependent variable.  The twostep estimator
produces estimates of these two values but does not estimate the variance of
rho or the covariance of rho and sigma with the other parameters.  So, the
standard errors of the conditional expectations would ignore these sources of
variation.  These variances and covariances simply are not part of the twostep
estimator.  -margins- refuses to proceed, knowing that it does not have
estimates of all of the sources of variation in the conditional expectations.

-mfx- enforced this requirement differently.  It provided point estimates, but
not standard errors.

When the Heckman model is fit by MLE, the variance and covariances of sigma
and rho are estimated and both -margins- and -mfx- will produce point
estimates and standard errors.

Norbert can instruct -margins- to perform its calculations ignoring its
inability to identify all sources of variation by adding the -force- option to
his command.  The point estimates are fine, but the SEs ignore that rho and
sigma are estimated.

If Norbert wishes to compare results from -margins- and -mfx-, he should add
the -atmeans- option to -margins-.  By default, -margins- computes average
marginal effects not marginal effects at the means (or specified values).
-mfx- could compute only the latter.

-- Vince

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index