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
Coefficient of the interaction term of AFT modelDear Statalist, I have a question about the explanation of coefficients of interactions terms of the…
List of observations in regressionHello, I am running a regression in STATA (xtgee). xtgee Profit number_employees company_size , li…
page break between two tables generated by -esttab-?Dear all, Is there a way to add a page break between two tables when using -esttab-? I want my code…
Panel data: Multiple IDs, partly duplicatedI have received panel data that need lots of cleaning. The most substantial challenge is finding a u…
How to increase decimal in league table for network meta-analysisThe league table of network meta-analysis shows only two decimal. I try to increase decimal. Try to …
Subscribe to:
Post Comments (Atom)
0 Response to Random slopes and random effects with melogit and xtmelogit
Post a Comment