Statalist The Stata Listserver


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

Re: st: svy:probit, margeff and lincom problem


From   Richard Williams <[email protected]>
To   [email protected], Statalist <[email protected]>
Subject   Re: st: svy:probit, margeff and lincom problem
Date   Wed, 09 Aug 2006 00:29:33 -0500

At 11:02 PM 8/8/2006, Dimitriy V. Masterov wrote:
I am trying to obtain the correct average marginal effect for age and
its square. I am getting a strange error message after using svy:
probit, margeff,  and lincom, which says that "matrix has missing
values". After looking at the trace, I believe the problem is that the
e(V_srs) matrix is missing. Also, using an ordinary probit seems to
work. Does anyone know of a way to deal with this?

My code is:

use "http://www.stata-press.com/data/r9/nhanes2f.dta";, clear
svy: probit heartatk height weight female black age age2
margeff, at(mean age=20 age2=0) replace
lincom age+2*20*age2
You are pushing your luck here. margeff was written before the svy: prefix came out, and was not designed to deal with this sort of thing. (On the other hand, my mfx2 command was written for Stata 9, and it has the exact same problem!)

I think this is the problem: margeff is saving all the local macros even as it does its replace. These local macros include svy-related items. lincom looks for those and acts accordingly. If you have eret2 installed, you can try the following:

use "http://www.stata-press.com/data/r9/nhanes2f.dta";, clear
svy: probit heartatk height weight female black age age2
margeff, at(mean age=20 age2=0) replace
eret2 local N_psu, replace
lincom age+2*20*age2

That will give you an answer. But is it the correct answer? I don' know. I suggest you compute a few answers by hand to see if you believe them. In this case you get


. lincom age+2*20*age2

( 1) age + 40 age2 = 0

------------------------------------------------------------------------------
heartatk | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1) | .0000361 .0000297 1.22 0.232 -.0000244 .0000966
------------------------------------------------------------------------------





-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
FAX: (574)288-4373
HOME: (574)289-5227
EMAIL: [email protected]
WWW (personal): http://www.nd.edu/~rwilliam
WWW (department): http://www.nd.edu/~soc
*
* 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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index