[R-sig-ME] help: newbies on fitting the simplest two-level GLMM
Fen
||@n2010 @end|ng |rom gm@||@com
Fri Mar 19 04:11:04 CET 2021
Hi dear all,
I am new to r mixed modeling using the lme4 package. I have a couple of
simple questions and I would appreciate it a lot if someone could help me
out with my questions. I have a (simplified) nested data set with items
produced by the same generating models, specifically I have 18 models,
under which each has 6 or 7 items, and each item has somewhat over 100
responses. I am trying to model the dependence in the data by fitting a
two-level GLM model with logit link function because my dependent variable
is binary. This is the model I used as shown in the output ( with some
explanations on the variable on the top) :
ID: item id
Model ID: generating model tied to the item id
summary(AIGresp1):
ID ModelID ScoredResponse
Length:13628 Length:13628 Min. :0.0000
Class :character Class :character 1st Qu.:1.0000
Mode :character Mode :character Median :1.0000
Mean :0.7778
3rd Qu.:1.0000
Max. :1.0000
**************************************************************************************************************************************************************
Generalized linear mixed model fit by maximum likelihood (Laplace
Approximation) ['glmerMod']
Family: binomial ( logit )
*Formula: ScoredResponse ~ 1 + (1 | ID) + (1 | ModelID) --> Model fitted *
Data: AIGresp1
AIC BIC logLik deviance df.resid
12242.9 12265.5 -6118.5 12236.9 13625
Scaled residuals:
Min 1Q Median 3Q Max
-8.3534 0.1197 0.3266 0.5361 1.7977
Random effects:
Groups Name Variance Std.Dev.
ID (Intercept) 0.3996 0.6322
ModelID (Intercept) 1.3779 1.1738
Number of obs: 13628, groups: ID, 119; ModelID, 18
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1.6555 0.2858 5.792 6.96e-09 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
More organized output as below:
> summ(m1)
MODEL INFO:
Observations: 13628
Dependent Variable: ScoredResponse
Type: Mixed effects generalized linear regression
Error Distribution: binomial
Link function: logit
MODEL FIT:
AIC = 12242.92, BIC = 12265.48
Pseudo-R² (fixed effects) = 0.00
Pseudo-R² (total) = 0.35
FIXED EFFECTS:
-----------------------------------------------
Est. S.E. z val. p
----------------- ------ ------ -------- ------
(Intercept) 1.66 0.29 5.79 0.00
-----------------------------------------------
RANDOM EFFECTS:
-----------------------------------
Group Parameter Std. Dev.
--------- ------------- -----------
ID (Intercept) 0.63
ModelID (Intercept) 1.17
-----------------------------------
Grouping variables:
---------------------------
Group # groups ICC
--------- ---------- ------
ID 119 0.08
ModelID 18 0.27
---------------------------
***************************************************************************************************************************************************************************
So in the model, both the items and models are the random effects, while
the intercept is the fixed effect. I shared this output because this is the
only model that gave me an output. Here are my questions:
1. As my items are nested under item models, the grouping variable should
be Model, but then in the organized output, I also had items as a grouping
variable too, maybe the way I modeled the multilevel structure is wrong?! I
also tried to fit the model by treating model as fixed effect: m01 <-
glmer(ScoredResponse~0+ModelID+(1|ID), AIGresp1,family=binomial), but then
my grouping ID became the IDs of items. I am really not so clear about how
to fit a multilevel model in this package in r and how can I tell my level
1 variables are truly level 1, so are my level 2 variables. Or does the
hiercharchy all reflect in the data structure?
2. The model I want to estimate is this one: m11 <-
glmer(ScoredResponse~-1+ID+(1|ModelID),AIGresp1,family=binomial); however,
it was running forever. I have to kill it in the end. When things like this
occur, what problems do it indicate?
3. I want to get the standard error estimates for random coefficients. I
read in the manual that only the standard errors of the fixed coefficients
are computed, any suggestions on the quickest to get the standard error
estimates for the random effects? Is there any function in the most recent
version of lme4, like mcmcsamp, that I can use to bootstrap the standard
error estimates?
Any comments would be highly appreciated!
Fen
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models
mailing list