[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
rgutierrez@stata.com (Roberto G. Gutierrez, StataCorp.) |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: Re: standard errors after nonlinear function of ... |

Date |
Mon, 14 Oct 2002 18:50:38 -0500 |

Dean Yang <dyang@fas.harvard.edu> asks: >> Is there a non-linear analog to the -lincom- command? I'd like to calculate >> a nonlinear function of some regression coefficients, and the associated >> standard error. >> I know we can test nonlinear hypotheses using -testnl-, but the command only >> saves chi or F-statistics and degrees of freedom. It doesn't give you the >> standard error on the estimate. and John Gibson <jkgibson@mngt.waikato.ac.nz> replied: > From testnl, if you use the > ... ,g(matname) > option you can save the Jacobian, and then plug that into the delta method > formula. To elaborate on what John suggests, I'll give an example using the auto data. We begin by fitting a linear regression . regress price weight length mpg [some output omitted] ------------------------------------------------------------------------------ price | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- weight | 4.364798 1.167455 3.74 0.000 2.036383 6.693213 length | -104.8682 39.72154 -2.64 0.010 -184.0903 -25.64607 mpg | -86.78928 83.94335 -1.03 0.305 -254.209 80.63046 _cons | 14542.43 5890.632 2.47 0.016 2793.94 26290.93 ------------------------------------------------------------------------------ Suppose then that our nonlinear combinations of parameters is f(b) = _b[length]/_b[mpg] that is, the ratio of the coefficients on -length- and on -mpg-. We call -testnl- with a test of f(b) = 0, and retrieve the matrix of first derivatives (the Jacobian), G. . testnl _b[length]/_b[mpg] = 0, g(G) (1) _b[length]/_b[mpg] = 0 F(1, 70) = 1.05 Prob > F = 0.3099 . mat list G G[1,4] c1 c2 c3 c4 r1 0 -.01152216 .01392232 0 We note that the derivatives of f(b) with respect to the first and last element of e(b), namely _b[weight] and _b[_cons], are zero. That's comforting considering that f(b) is not a function of these two parameters. Applying the delta method, . mat A = G*e(V)*G' . mat list A symmetric A[1,1] r1 r1 1.3953568 gives the estimated variance. --Bobby rgutierrez@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/

- Prev by Date:
**[no subject]** - Next by Date:
**st: log of variables in xtreg** - Previous by thread:
**[no subject]** - Next by thread:
**st: log of variables in xtreg** - Index(es):

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