1
$\begingroup$

I designed an experiment to observe the shading effect in the distribution of 2 species of crabs through time. So basically I have 4 levels of shading (no shade, 20%, 50%, and 80%) with 7 ID to each (28 in total), and counted the number of species A and B in different time points (0, 1, 2, 3, 5, 7, 10, and 13 months). Therefore I compared a random intercept model with a random slope model and the code and summary are as follows:

a <- cbind(ul=Eco$ul, uu=Eco$total - Eco$ul)
kable(a[1:224,])
modr1 <- glmer(a ~ time + shade + time:shade + (time|id), data=Eco, family = "binomial" (link="logit"), control = glmerControl(optimizer ="Nelder_Mead"))
modr2 <- glmer(a ~ time + shade + time:shade + (1|id), data=Eco, family = "binomial"(link="logit"), control = glmerControl(optimizer ="Nelder_Mead"))
anova(modr2, modr1, test="Chisq")

modr2: a ~ time + shade + time:shade + (1 | id)

modr1: a ~ time + shade + time:shade + (time | id)

npar    AIC    BIC  logLik deviance Chisq Df Pr(>Chisq)
    
modr2    9 1459.5 1489.9 -720.75   1441.5 
                       
modr1   11 1449.5 1486.7 -713.73   1427.5 14.04  2  0.0008938 ***

Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

    summary(modr1)

Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) [glmerMod]

Family: binomial  ( logit )

Formula: a ~ time + shade + time:shade + (time | id)

Data: Eco

Control: glmerControl(optimizer = "Nelder_Mead")

AIC      BIC   logLik deviance df.resid 

1449.5   1486.6   -713.7   1427.5      206 

Scaled residuals: 

Min      1Q  Median      3Q     Max 

-4.7771 -1.1861  0.0898  0.9981  6.6329 

Random effects:

Groups Name        Variance Std.Dev. Corr

id     (Intercept) 0.464780 0.68175  
    
time        0.002967 0.05447  0.18

Number of obs: 217, groups:  id, 28

Fixed effects:

Estimate Std. Error z value Pr(>|z|) 
   
(Intercept)   2.403518   0.311480   7.716  1.2e-14 ***

time         -0.058801   0.032595  -1.804   0.0712 .  

shade20      -0.806281   0.420579  -1.917   0.0552 .  

shade50      -0.336302   0.425565  -0.790   0.4294    

shade80      -1.132901   0.417071  -2.716   0.0066 ** 

time:shade20  0.009717   0.041886   0.232   0.8165    

time:shade50 -0.028839   0.043842  -0.658   0.5107    

time:shade80 -0.096730   0.042004  -2.303   0.0213 *  

Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Correlation of Fixed Effects:

(Intr) time   shad20 shad50 shad80 tm:s20 tm:s50

time        -0.233  
                                        
shade20     -0.732  0.163  
                                 
shade50     -0.724  0.160  0.532  
                          
shade80     -0.744  0.172  0.546  0.539    
                 
time:shad20  0.170 -0.762 -0.160 -0.120 -0.126  
            
time:shad50  0.159 -0.719 -0.114 -0.183 -0.116  0.556  
     
time:shad80  0.179 -0.776 -0.126 -0.123 -0.155  0.592  0.554

My questions are: How to interpret the random effect?? How can I know the percentage of explanation from both random and fixed factors?? Do I need to know the variance of the residuals?

Thanks!

$\endgroup$

1 Answer 1

3
$\begingroup$

How to interpret the random effect??

Generally we don't usually interpret the random effects. We specify random effects to account for non-independence of observations with repeated measures. Random slopes are used to allow for the "effect" of a variable to differ between levels of a grouping variable (in this case ID).

According to the question you are interested in the shading effect in the distribution of 2 species of crabs through time. The estimates of the fixed effects in the model will answer this. There is no need to try to interpret the random effects in the way you are.

How can I know the percentage of explanation from both random and fixed factors??

This kind of thing does not really make sense for a generalised linear mixed model. When you have random slopes for a variable, it is both fixed and random so to begin with, the idea of seperating variation in to fixed and random factors does not make sense.

Do I need to know the variance of the residuals?

This is a logistic model, so there is no residual variation - or rather it is fixed, as the variance of the logistic distribution, $\frac{\pi^2}{3}$.

$\endgroup$
4
  • $\begingroup$ Could you explain that final remark? I do not see any use (or even validity) of the assertion "there is no residual variation." Relevant threads include stats.stackexchange.com/questions/185491, stats.stackexchange.com/questions/128750, stats.stackexchange.com/questions/253231, and stats.stackexchange.com/questions/161581. $\endgroup$
    – whuber
    Commented Jan 15, 2021 at 20:06
  • $\begingroup$ @whuber I mean that there will be no residual variation reported by summary(model) because logistic regression models do not have an error term. $\endgroup$ Commented Jan 15, 2021 at 20:15
  • $\begingroup$ They do have residuals, though. For instance, nlme:::plot.lme graphically displays them, and ordinarily they do vary. $\endgroup$
    – whuber
    Commented Jan 15, 2021 at 20:21
  • $\begingroup$ @whuber Agreed, there must be residuals (unless the model has perfect fit), it's just that there won't be any reported residual variation. $\endgroup$ Commented Jan 15, 2021 at 20:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.