[R-sig-ME] Basic question confidence intervals glmer

Douglas Bates bates at stat.wisc.edu
Thu Mar 24 15:15:40 CET 2011


On Wed, Mar 23, 2011 at 7:31 PM, Sandra M. Durán <sduran at ualberta.ca> wrote:
> Hi, I want to evaluate if bird species respond strongly to management,
> vegetation or both. I am running different models with different species.
> Here is the overall formula here:

> print(fm1 <- glmer(birds ~ ownership + (1 | site), family=poisson,
> data=wma))

> And I want to know the syntax to get the confidence intervals (lower and
> upper limit) for the parameters in the fixed effects. I have used:

> confint(fm1), but I get an error message, although this code has worked for
> me when I used glm. It is possible to specify the confidence level(0.90,
> 0.95)?

A way of getting approximate confidence intervals is to use the
coefficients table from the summary for the model, as shown in the
enclosed.

These confidence intervals are approximations.  A more reliable
approach would be to profile the deviance with respect to the
parameters of interest but that has not yet been implemented.

Note that in cases like this example and for your example confidence
intervals on coefficients associated with contrasts for a factor may
not be of too much interest by themselves, because they are expressed
with respect to a somewhat arbitrary reference level for the factor.
Also these do not take into account multiple comparisons.


>
>
> Thanks so much for any insights.
>
>
>
> The output I get is:
>
>
>
> Generalized linear mixed model fit by the Laplace approximation
>
> Formula: birds ~ ownership + (1 | site)
>
>   Data: wma
>
>   AIC   BIC logLik deviance
>
>  171.3 184.7 -81.63    163.3
>
> Random effects:
>
>  Groups Name        Variance Std.Dev.
>
>  site   (Intercept) 0.099663 0.31569
>
> Number of obs: 211, groups: site, 36
>
>
>
> Fixed effects:
>
>                     Estimate Std. Error z value Pr(>|z|)
>
> (Intercept)            0.1209     0.1497   0.807  0.41947
>
> ownershipCrownland     0.5362     0.1977   2.712  0.00669 **
>
> ownershipPrivateland   0.3902     0.1956   1.995  0.04608 *
>
> ---
>
> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>
>
>
> --
> Sandra M Durán
> University of Alberta
>
>        [[alternative HTML version deleted]]
>
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
>
-------------- next part --------------

R version 2.12.2 (2011-02-25)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(lme4)
Loading required package: Matrix
Loading required package: lattice

Attaching package: 'Matrix'

The following object(s) are masked from 'package:base':

    det


Attaching package: 'lme4'

The following object(s) are masked from 'package:stats':

    AIC

> print(fm1 <- glmer(cbind(incidence, size-incidence) ~ period + (1|herd),
+                    cbpp, binomial), corr=FALSE)
Generalized linear mixed model fit by the Laplace approximation 
Formula: cbind(incidence, size - incidence) ~ period + (1 | herd) 
   Data: cbpp 
   AIC   BIC logLik deviance
 110.1 120.2 -50.05    100.1
Random effects:
 Groups Name        Variance Std.Dev.
 herd   (Intercept) 0.4125   0.64226 
Number of obs: 56, groups: herd, 15

Fixed effects:
            Estimate Std. Error z value Pr(>|z|)    
(Intercept)  -1.3985     0.2279  -6.137 8.42e-10 ***
period2      -0.9923     0.3054  -3.249 0.001156 ** 
period3      -1.1287     0.3260  -3.462 0.000537 ***
period4      -1.5804     0.4288  -3.686 0.000228 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 
> (coeftbl <- as.data.frame(coef(summary(fm1))))
              Estimate Std. Error   z value     Pr(>|z|)
(Intercept) -1.3985350  0.2278906 -6.136871 8.416284e-10
period2     -0.9923347  0.3053852 -3.249452 1.156274e-03
period3     -1.1286754  0.3260491 -3.461673 5.368286e-04
period4     -1.5803739  0.4288037 -3.685542 2.282169e-04
> ## 95% confidence intervals
> with(coeftbl,
+      Estimate + outer(`Std. Error`, c(lower=-1, upper=1)) * sqrt(qchisq(0.95, 1)))
         lower      upper
[1,] -1.845192 -0.9518777
[2,] -1.590879 -0.3937907
[3,] -1.767720 -0.4896309
[4,] -2.420814 -0.7399341
> 
> ## 99% confidence intervals
> with(coeftbl,
+      Estimate + outer(`Std. Error`, c(lower=-1, upper=1)) * sqrt(qchisq(0.99, 1)))
         lower      upper
[1,] -1.985542 -0.8115278
[2,] -1.778955 -0.2057145
[3,] -1.968522 -0.2888286
[4,] -2.684899 -0.4758487
> 
> proc.time()
   user  system elapsed 
  6.150   0.200   6.339 


More information about the R-sig-mixed-models mailing list