Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: predicted probabilities for three-way interaction in xtmelogit
From
Ola Sjöberg <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: predicted probabilities for three-way interaction in xtmelogit
Date
Fri, 24 Jan 2014 08:24:36 +0000
Dear Members,
I am trying to calculate predicted probabilities that include random effects in xtmelogit.
I am estimating a simple random intercepts model. In this model I have a three-way cross-level interaction term, education*GDP*Generosity, where:
Education=level-one variable (separating between low- and high educated)
GDP=level-2 variable (continuous)
Generosity=level-2 variable (continuous)
Dependent variable is health (1=good health, 0=bad health)
So, I am trying to estimate the model: xtmelogit health i.education##c.GDP##c.Generosity
I would like to get predicted probabilities for having good health for low- and high educated, along the observed values for Generosity, and for three levels of GDP (low, medium and high)
Thanks to the excellent Stata FAQ "How can I estimate probabilities that include the random effects in xtmelogit". I can get predicted probabilities that include random effects, but only for two-way interaction effects, and not my three-way interaction effect.
I am using the following syntax, which is working fine for estimating probabilities along the variable generosity (values=100, 120, 140 etc). But now I would like to see how these selected probabilities vary for three values of GDP (=50, 100, 150)
Basically, as I understand I would like to get second variable in there (j=50(50)100, but I can't get it to work:
xtmelogit health i.education##c.GDP##generosity || group:
predict mu1, mu
predict re*, reffects
forvalues i=100(20)220 {
quietly replace generosity = `i'
quietly replace education = 1
predict xbm`i' , xb
gen mum`i' = 1 /(1+exp(-1*(xbm`i' + re1)))
quietly replace education = 2
predict xbf`i' , xb
gen muf`i' = 1 /(1+exp(-1*(xbf`i' + re1)))
}
sum mum* muf*
Thanks!
Ola, Stockholm university
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/