# [R-sig-ME] Wald t-tests for glmer

Albyn Jones jones at reed.edu
Thu Dec 29 00:50:04 CET 2011

The Wald tests for coefficients are given in the summary table, labeled
"z value": \hat{\beta}/SE(\hat{\beta}).

albyn

Quoting Michael Allen <michaelcobballen at yahoo.com>:

> Dear List,
> I have a "Poisson-lognormal" mixed model (structure and output
> below).Â  I would like to perform Wald t-tests to obtain P-values
> for the parameter estimates.Â  I understand that one way to do this
> is to use the z-scores provided by summary() as the t-values. My
> question is what I should use as my df, given the model structure
> below. The y-data are bird counts recorded during 646 surveys at 44
> transect locations.Â  So each transect was surveyed multiple
> times...thus, the inclusion of (1|trans), which is essentially the
> "name" indicating which of the 44 transects were surveyed (e.g.,
> L_01, W_04, etc.).Â  Data were overdispersed, so a random term
> representing individual-level variation was included (i.e.,
> (1|obs)).Â  Should the df for the t-tests be 646 - 1 = 645 or maybe
> 44 - 1 = 43 ? Is there another way to calculate them? Am I even
> doing the Wald tests correctly? Thanks in advance for your help.
>
> Mike
>
>
> library(lme4)
> library(arm)
> db\$obs=1:nrow(db)
>
> b.dens.veg2=glmer(dens~year+site+de+avghtin1+I(avghtin1^2)+avghtin1*site+(1|trans)+(1|obs),data=db,family=poisson)
>
>> summary(b.dens.veg2)
> Generalized linear mixed model fit by the Laplace approximation
> Formula: dens ~ year + site + de + avghtin1 + I(avghtin1^2) +
> avghtin1*site + (1 | trans) + (1 | obs)
> Â Â  Data: db
> Â Â  AICÂ Â  BIC logLik deviance
> Â 697.2 750.9 -336.6Â Â Â  673.2
> Random effects:
> Â Groups NameÂ Â Â Â Â Â Â  Variance Std.Dev.
> Â obsÂ Â Â  (Intercept) 0.094321 0.30712
> Â transÂ  (Intercept) 0.049609 0.22273
> Number of obs: 646, groups: obs, 646; trans, 44
>
> Fixed effects:
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â  Estimate Std. Error z value Pr(>|z|)Â Â Â
> (Intercept)Â Â Â Â  0.36736Â Â Â  0.16844Â Â  2.181Â Â  0.0292 *Â
> year2Â Â Â Â Â Â Â Â Â Â  0.17644Â Â Â  0.07472Â Â  2.361Â Â  0.0182 *Â
> year3Â Â Â Â Â Â Â Â Â Â  0.02453Â Â Â  0.07537Â Â  0.326Â Â  0.7448Â Â Â
> sitePÂ Â Â Â Â Â Â Â Â Â  0.41106Â Â Â  0.22915Â Â  1.794Â Â  0.0728 .Â
> siteWÂ Â Â Â Â Â Â Â Â Â  0.31676Â Â Â  0.20634Â Â  1.535Â Â  0.1248Â Â Â
> deEÂ Â Â Â Â Â Â Â Â Â Â  -0.53292Â Â Â  0.08145Â  -6.543 6.02e-11 ***
> avghtin1Â Â Â Â Â Â Â  0.06967Â Â Â  0.18736Â Â  0.372Â Â  0.7100Â Â Â
> I(avghtin1^2)Â Â  0.06706Â Â Â  0.05755Â Â  1.165Â Â  0.2440Â Â Â
> siteP:avghtin1 -0.28355Â Â Â  0.17117Â  -1.657Â Â  0.0976 .Â
> siteW:avghtin1Â  0.31147Â Â Â  0.16166Â Â  1.927Â Â  0.0540 .Â
> ---
> Signif. codes:Â  0 â€˜***â€™ 0.001 â€˜**â€™ 0.01 â€˜*â€™ 0.05
> â€˜.â€™ 0.1 â€˜ â€™ 1
>
> Correlation of Fixed Effects:
> Â Â Â Â Â Â Â Â Â Â Â  (Intr) year2Â  year3Â  sitePÂ  siteWÂ
> deEÂ Â Â  avght1 I(1^2) stP:v1
> year2Â Â Â Â Â Â
> -0.161Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
> year3Â Â Â Â Â Â  -0.145Â
> 0.591Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
> sitePÂ Â Â Â Â Â  -0.388 -0.124
> -0.134Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
> siteWÂ Â Â Â Â Â  -0.612Â  0.070Â  0.067Â
> 0.492Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
> deEÂ Â Â Â Â Â Â Â  -0.060 -0.002 -0.003 -0.007
> -0.018Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
> avghtin1Â Â Â  -0.802 -0.045 -0.080Â  0.081Â  0.324
> -0.006Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
> I(vghtn1^2)Â  0.437 -0.078 -0.007Â  0.381Â  0.085Â  0.007
> -0.759Â Â Â Â Â Â Â Â Â Â Â Â Â
> sitP:vghtn1Â  0.287Â  0.148Â  0.139 -0.848 -0.467 -0.002 -0.077
> -0.512Â Â Â Â Â Â
> sitW:vghtn1Â  0.542 -0.074 -0.071 -0.433 -0.864Â  0.018 -0.412 -0.076Â  0.551
>
> # my attempt at Wald t-tests, assuming 645 df (i.e., number of
> observations minus 1)
>
>> t=fixef(b.dens.veg2)/se.fixef(b.dens.veg2)
>> p=data.frame(p=2*pt(abs(t),df=645,lower.tail=F))
>> data.frame(t,p)
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  tÂ Â Â Â Â Â Â Â Â Â Â  p
> (Intercept)Â Â Â Â  2.1809174 2.955005e-02
> year2Â Â Â Â Â Â Â Â Â Â  2.3613006 1.850732e-02
> year3Â Â Â Â Â Â Â Â Â Â  0.3255303 7.448853e-01
> sitePÂ Â Â Â Â Â Â Â Â Â  1.7938740 7.330155e-02
> siteWÂ Â Â Â Â Â Â Â Â Â  1.5351187 1.252450e-01
> deEÂ Â Â Â Â Â Â Â Â Â Â  -6.5432216 1.227467e-10
> avghtin1Â Â Â Â Â Â Â  0.3718450 7.101304e-01
> I(avghtin1^2)Â Â  1.1651422 2.443921e-01
> siteP:avghtin1 -1.6565831 9.809013e-02
> siteW:avghtin1Â  1.9266674 5.446011e-02
>
> # my other attempt at Wald t-tests, assuming 43 df (i.e., number of
> transects minus 1)
>
>> t=fixef(b.dens.veg2)/se.fixef(b.dens.veg2)
>> p=data.frame(p=2*pt(abs(t),df=43,lower.tail=F))
>> data.frame(t,p)
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  tÂ Â Â Â Â Â Â Â Â Â Â  p
> (Intercept)Â Â Â Â  2.1809174 3.470626e-02
> year2Â Â Â Â Â Â Â Â Â Â  2.3613006 2.281215e-02
> year3Â Â Â Â Â Â Â Â Â Â  0.3255303 7.463586e-01
> sitePÂ Â Â Â Â Â Â Â Â Â  1.7938740 7.986700e-02
> siteWÂ Â Â Â Â Â Â Â Â Â  1.5351187 1.320807e-01
> deEÂ Â Â Â Â Â Â Â Â Â Â  -6.5432216 5.923002e-08
> avghtin1Â Â Â Â Â Â Â  0.3718450 7.118344e-01
> I(avghtin1^2)Â Â  1.1651422 2.503844e-01
> siteP:avghtin1 -1.6565831 1.048840e-01
> siteW:avghtin1Â  1.9266674 6.064659e-02
> 	[[alternative HTML version deleted]]
>
>