# code needed for p values in GLMM

I need to get p values for the fixed effects in the following GLMM's I ran. Does anyone know of code that I can run that will give me the p values I need? At the moment the output from the ANOVA only gives me one p value and I believe I need a separate p value for each of the fixed effects in the models.

Thanks in advance. Code is as follows -

For GLMM 1 I ran this code -

m1<-lmer(step~Depth*threshold+(1|ind))
m2<-lmer(step~(1|ind))
anova(m1,m2)


For GLMM 2 I ran this code -

m2<-lmer(PDBA~step*threshold+Depth*threshold+(1|ind))
m3<-update(m2,~.-step*threshold)
anova(m2,m3)


and this one:

m2<-lmer(PDBA~step*threshold+Depth*threshold+(1|ind))
m4<-update(m2,~.-Depth*threshold)
anova(m2,m4)


When I ran GLMM 1 code this is what I got:

m2: step ~ (1 | ind)
m1: step ~ Depth * threshold + (1 | ind)
Df    AIC    BIC  logLik deviance  Chisq Chi Df Pr(>Chisq)
m2  3 373235 373259 -186615   373229
m1  8 373225 373290 -186605   373209 19.767      5   0.001382 **
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1


summary

> summary(m1)
Linear mixed model fit by REML ['lmerMod']
Formula: step ~ Depth * threshold + (1 | ind)

REML criterion at convergence: 373184

Random effects:
Groups   Name        Variance Std.Dev.
ind      (Intercept) 196519   443.3
Residual             469370   685.1
Number of obs: 23473, groups: ind, 11

Fixed effects:
Estimate Std. Error t value
(Intercept)      160.95895  134.80279   1.194
Depth              0.06438    0.44777   0.144
threshold2        51.18065   17.62222   2.904
threshold3         1.47733   21.43879   0.069
Depth:threshold2  -1.23654    0.60029  -2.060
Depth:threshold3  -0.09587    0.65088  -0.147

Correlation of Fixed Effects:
(Intr) Depth  thrsh2 thrsh3 Dpth:2
Depth       -0.094
threshold2  -0.090  0.712
threshold3  -0.075  0.588  0.567
Dpth:thrsh2  0.071 -0.737 -0.745 -0.435
Dpth:thrsh3  0.064 -0.674 -0.490 -0.857  0.502


OUTPUT FROM SUGGESTED CODE BY SETH (IN COMMENTS)

Models:
m6: step ~ Depth + threshold + (1 | ind)
m5: step ~ Depth + threshold + Depth:threshold + (1 | ind)
Df    AIC    BIC  logLik deviance  Chisq Chi Df Pr(>Chisq)
m6  6 373227 373275 -186607   373215
m5  8 373225 373290 -186605   373209 5.2901      2      0.071 .
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

• Do you know what degrees of freedom you want to use for the t statistics that you see in summary(m4)?
– Seth
Apr 15 '14 at 17:03
• Also, the p-values you see in the anovas are for the variables that are omitted from one of the two regressions being compared.
– Seth
Apr 15 '14 at 17:07
• I am afraid I am a complete novice Seth, trying to do things far beyond my ability atm :( If I post my output and summary for the first one say, do you think you might be able to talk me through it? Suggest code to get p values? Apr 15 '14 at 17:13

I am going to walk through how I do these:

m1<-lmer(step~Depth*threshold+(1|ind))
m2<-lmer(step~(1|ind))
anova(m1,m2)


This anova tells you if the depth*threshold made a significant contribution to model fit. The way it is written with a * indicates that your model m1 should have direct effects and interactions. So the anova is a omnibus type test for all the levels and interaction of the levels of Depth and threshold. If you are interested in particular levels, or if you are interested in the direct effect and not the interaction you should enter them seperately. and leave them out individually and run anovas.

For example, if you are interested in the interaction.

m5<-lmer(step~Depth + threshold + Depth:threshold+(1|ind))
m6<-lmer(step ~ Depth + threshold +(1|ind))
anova(m5,m6)


The p-value from this anova will tell you if the interaction of depth and threshold is significant given the direct effects.

• Ok, thank you so much, I have posted my output from that above in the thread. Do you know how I would present my results in a simple table which states 'effect', 'SE', 'test statistic' and 'P Value' for all of the fixed effects? Apr 15 '14 at 17:31
• I am sorry for my complete lack of ability, I have been pretty much abandoned by my tutor in my efforts to managed my huge data set and don't really know who to ask. Apr 15 '14 at 17:34
• My fixed effects for that model (GLMM 1) would be 'depth' and 'threshold' Apr 15 '14 at 17:35
• No problem if you can't help. Thank you for your help this far, Ruth. Apr 15 '14 at 17:59