I have a large dataset and have performed a multilevel regression in Stata, the model is the following:
xtmixed dependent independen1 independent2 independent3 independent4 || independendt5:
So there is one grouping factor:
In R I did the following:
lmer(dependent ~ independent1 + indepdendent2 + independent3 + independent4 + 1 | independent5, REML=TRUE)
A few questions: is this identical?
Stata output gives me number of groups, 100, while R gives number of groups as 99.
Furthermore, the variances and standard deviations are not the same.
Also I would like to know how to obtain p values and coefficients from the R ouput.
I have done
ranef(model) but when I do
coef(model) it says:
Error in coef(model) : unable to align random and fixed effects
Also Stata only gives me 1 coefficient for each predictor while the R
fixef(model) gives one for each group.
So someone familiar with both Stata and R could help me with this.