Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: How to calculate the standard errors for the MFX afterintreg


From   May Boggess <mboggess@stata.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: How to calculate the standard errors for the MFX afterintreg
Date   24 Sep 2004 08:41:00 -0500

On Friday, Bo MacInnis wrote:
 
> My estimation should be -tobit-, and I use -intreg- to obtain robustness 
> standard errors. I can calculate the mfx "by hand" but don't know exactly 
> how to calculate the standard errors for the marginal effect. I am aware of 
> the wonderful tool -dtobit- that does the magic after -tobit-. Does anyone 
> know a command to calculate the mfx for -intreg-?
> 

The command -mfx- can calculate marginal effects, and their standard
errors, after -intreg-. However, it is not so difficult to do it other
ways as well.

If you know the analytical formula for the derivative (ie. marginal
effect), you can use -predictnl- to get the standard error. The only
difference between -generate- and -predictnl- is that -predictnl-
can use the delta method to calculate the standard errors. 

Let's have an easy example, probability of success following -logit-:

 clear
 sysuse auto
 logit for mpg
 sum mpg if e(sample)
 local mean=r(mean)
 gen y=exp(_b[mpg]*`mean'+_b[_cons])/(1+exp(_b[mpg]*`mean'+_b[_cons]))
 predictnl dydx=_b[mpg]*exp(_b[mpg]*`mean'+_b[_cons])/ /*
	*/ (1+exp(_b[mpg]*`mean'+_b[_cons]))^2, se(se) 
 list y dydx se in 1
 mfx

Here y is the predicted probability of success, evaluated at the mean of
the covariate mpg.I can take the derivative of y with respect to the
covariate mpg using the quotient rule. Rather than using -generate- to
calculate the value of dydx (ie. the marginal effect) at
the mean of mpg, I will use  -predictnl- so I can also get the standard
error as well. If I have not made a mistake, my results should agree
with those of -mfx-.

There are several examples of using -predictnl- to get standard errors
of marginal effects in the following FAQ on marginal effects for models
with interactions:

 http://www.stata.com/support/faqs/stat/mfx_interact.html


--May
mmb@stata.com


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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