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
Recognize datasetHello all together, I am new here and I am happy to join the Stata cummunity. Currently I'm writing…
Trying to combine two files that are linked by a common ID#Hi all, I'm new to Stata and would appreciate any direction here! I'm currently working with two fi…
A way to delete output stored in outreg2 without using replace?Dear all, I was wondering if there is a way to delete output stored in outreg2 without using "outre…
Sample Size Calculation for a Population ProportionSo, the research question at hand is: Of farmers growing a biofortified corn variety, what percentag…
ARIMA model for a large data setHello, I'm doing an analysis of a movement of an object in time (Position X, Y, and Z). I'm trying …
Subscribe to:
Post Comments (Atom)
0 Response to A multilevel model succeeds in STATA but fails in R
Post a Comment