Hi,
I fit a simple variance component multilevel model with a large longitudinal dataset (obs>60,000). The model has three levels: obs->individual->community. The dependent variable 'phi' is a binary variable, with 95% 0 and 5% 1.
I tried both STATA and R ('lme4' package)
The STATA code is:
melogit phi || commid: || idind:
The R code is:
fit <- glmer(phi~ (1 | commid/idind), data = dt, family = binomial("logit"))
The problem is that STATA can quickly estimate this model, while R gives an error message: "Model failed to converge with max|grad| = 0.0377982 (tol = 0.001, component 1)".
I reckon the problem is the unbalanced dependent variable, which R struggles to handle (I tried other more balanced binary dependent variables, R managed).
Does anyone know why STATA and R have so different performance in this case?
Related Posts with A multilevel model succeeds in STATA but fails in R
Unzipping fileHello. I am having trouble unzipping a file with Stata. Please see picture attached. …
by id: replace var1[1] = max(var1), error "weights not allowed"Dear community I have the following types of panel data: The actual data is huge, so ask questions t…
Help with xtreg, splines and trends?Hi all, since my last post I have read the FAQs and so this should be a better post; Now, I am doin…
Time variable issue when trying a difference in difference approachGood day I want to perform a difference in difference regression defined as Code: mi estimate, e…
ASDOC: Dropping base level of factor variablesDear all users pf Statalist I do not find option of the command of asdoc to drop base level of fact…
Subscribe to:
Post Comments (Atom)
0 Response to A multilevel model succeeds in STATA but fails in R
Post a Comment