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   Chris Ruebeck <[email protected]>
To   [email protected]
Subject   Re: st: svy:probit, margeff and lincom problem
Date   Thu, 10 Aug 2006 11:19:06 -0400

May I check on what problem mfx2 has with the svy: prefix? Should I expect mfx2 to work correctly after svy: probit? I hope that the email exchange quoted below indicates only that mfx2 makes problems for lincom, not that svy: probit makes problems for mfx2 directly.

My coauthors and I have just started using mfx2 because (according to the abstract on IDEAS) it works well with outreg2. We were having problems with svy: probit followed by mfx and then outreg2, but replacing mfx with mfx2 appears to make things work.

Chris


On Aug 9, 2006, at 1:29 AM, Richard Williams wrote:


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/
*
*   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