You can get what you want by generating extra observations containing
covariates with values where you want them for the predictions, and then set
the random effect to zero. It's illustrated in the following do-file.
Joseph Coveney
----------------------------------------------------------------------------
* creating fictional dataset here
clear
set more off
set seed 20040511
set obs 200
generate int pid = _n
forvalues i = 1/3 {
generate byte y`i' = uniform()>0.5
generate float xcon`i' = uniform()
generate byte xcat`i' = round(5 * uniform(), 1)
}
generate byte sex = uniform() > 0.5
reshape long xcat xcon y, i(pid) j(tim)
* model fitted here
xi: xtlogit y xcon sex i.xcat, i(pid)
* creating predictions beginning here
set obs 604
summarize xcon if tim == 1
replace xcon = r(mean) in 601/602
replace sex = 0 in 601
replace sex = 1 in 602
forvalues i = 1/5 {
replace _Ixcat_`i' = 0 in 601/l
}
replace _Ixcat_3 = 1 in 601/l
replace xcon = 5 in 603/l
replace sex = 0 in 603
replace sex = 1 in 604
predict y_hat, pu0
slist in 601/l // <- this has the predictions you want
exit
----------------------------------------------------------------------------
Christer Thrane wrote
While there are numerous semi-automatic ways of getting predicted
probabilities for regular logit/probit models, I cannot find these for
xtlogit/xtprobit.
My model (in Stata) is:
xtlogit y gender xcon xcat, re
where
y is a binary variable measured at three time points
gender is coded 1 for male and zero for female
xcon is a continionus time-varying covariate
xcat is an ordinal time-varying covariate with five values.
I want to get the following predicted probabilities:
(1) for men and women, respectively, with xcon = mean and xcat = 3
(2) for men and women, respectively, with xcon = 5 and xcat = 3
*
* 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/