Statalist The Stata Listserver


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

st: adjust problem


From   "Dimitriy V. Masterov" <[email protected]>
To   Statalist <[email protected]>
Subject   st: adjust problem
Date   Mon, 28 Aug 2006 20:01:47 -0400

I am running bivariate probits for several outcomes using the same set
of variables on the right hand side. Then I am using the adjust
command to calculate the predicted probabilities for each age holding
the Xs constant for the whole sample (at the e(sample) mean). Here's
my simplified code:

foreach outcome in o1 o2 o3 {;
probit `outcome' age age2 x1 x2 x3;
adjust x1 x2 x3 if e(sample), pr by(age age2) gen(`outcome'_hat)
}

However, in some of the specifications, x1 predicts failure perfectly,
and is dropped. When I try to use the adjust command, it fails because
the dropped variable is not used in last estimation. I tried including
the names of the included variables in a local:

foreach outcome in o1 o2 o3 {;
probit `outcome' age age2 x1 x2 x3;
adjust `=subinstr("`:colfullnames e(b)'","_cons","",.)' if e(sample),
pr by(age age2) gen(`outcome'_hat)
}

Unfortunately, this does not work when I have a lot of Xs because the
local is too long. Is there a way to get Stata to do what I want?

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