melogit CSES5govact c.CSES5corrupt c.income c.gini c.polstrust || E1003: CSES5corrupt
I'm running a two-level logit trying to get reliable random slopes for CSES5corrupt, ideally with confidence intervals. What works in melogit is not giving me a random slope common to each level 2 unit (E1003, which is country/election). The following I've got from an earlier post in the forums but it's not what I'm after.
predict fe, xb ///// linear prediction, fixed portion only
predict re, reffects reses(reses) /////empirical Bayes means for _cons[E1003]
gen predicted fe + re
gen lower_ci = predicted - 1.96*reses
gen upper_ci = predicted + 1.96*reses
but predict fe, xb is not giving me the random slope I want - it varies within the level 2 cases. So all I'm getting is the constant and its standard error from the second line of code. The next two lines are getting me a prediction for each level 1 case which I don't want.
When I run the same model in xtmelogit and use the code below I do get what I want (I think)
predict re_slope re_cons, reffects ///// creates two variables, random effects for E1003: CSEScorrupt & random effects for E1003:_cons
predict u0se u1se, reses //// re standard errors for them both
this gives me a random slope for each level 2 unit, the constant for each unit, and their standard errors.
But when I try to run this code after melogit I get 'too many variables specified'.
Anyone know how I can get these after melogit (which is faster). Melogit and xtmelogit also give slightly different results and I understand xtmelogit is an older version. And, ideally, get confidence intervals too boot? I have gone to the various help options and the manual but I'm not finding any worked examples or instructions i can make sense of.
Related Posts with Random slopes and random effects with melogit and xtmelogit
Trend test in StataHello, I have been using Stata to analyse all of my data, however my supervisor has asked me to per…
ado programming option helpHello Forum, I have successfully written a ado-command, unfortunately I have problem with one littl…
new version smclpres available on SSCThanks to Kit Baum a new version of smclpres is now available from SSC. To install type in Stata ssc…
Generating cluster averageHi I would like to create a variable that measures the cluster average of women’s working status. I …
Specifying the start date of a generated time-series variableHi, What is the simplest method to count quarters from Feb 1972 to Apr 1993? I am generating a qua…
Subscribe to:
Post Comments (Atom)
0 Response to Random slopes and random effects with melogit and xtmelogit
Post a Comment