[R-sig-ME] Presentation of results from GLMMs
Renwick, A. R.
a.renwick at abdn.ac.uk
Thu Apr 16 13:24:23 CEST 2009
Dear All
A while back there was a question regarding plotting predicted values (https://stat.ethz.ch/pipermail/r-sig-mixed-models/2009q1/002044.html). There was not much response which I take to assume there is no definitive answer. However I wonder if anyone could give me a bit of advice as to how to present results for a GLMM model with a binomial error structure.
Here is an example:
y<-cbind(both$Totalmoreonce,both$UsedOnce)#an index of aggregation in a population of voles
hier3<-lmer(y~Sex+Margin+sess+(1|Farm/Site), family=binomial, data=both, REML=FALSE)
summary(hier3)
#Generalized linear mixed model fit by the Laplace approximation
#Formula: y ~ Sex + Margin + sess + (1 | Farm/Site)
# Data: both
# AIC BIC logLik deviance
# 191.0 213.5 -86.49 173.0
#Random effects:
# Groups Name Variance Std.Dev.
# Site:Farm (Intercept) 0.039191 0.19797
# Farm (Intercept) 0.000000 0.00000
#Number of obs: 90, groups: Site:Farm, 14; Farm, 7
#
#Fixed effects:
# Estimate Std. Error z value Pr(>|z|)
#(Intercept) -2.20209 0.33088 -6.655 2.83e-11 ***
#Sexmale -0.31110 0.12781 -2.434 0.014928 *
#Marginmedium 0.07763 0.34604 0.224 0.822483
#Marginwide 1.23916 0.30748 4.030 5.58e-05 ***
#sessAugust 0.60537 0.18324 3.304 0.000954 ***
#sessJune 0.58132 0.18511 3.140 0.001687 **
#sessOctober -0.64398 0.24468 -2.632 0.008491 **
Now I want to show graphically that y changes with margin width, ideally using predicted values while accounting for the other variables in the model.
invlogit<-function(x){1/(1+exp(-x))}#function to backtransform the logit values in model
#predicted values bsaed on only the fixed effects for each margin width
w<-invlogit(cbind(1,0,0,1,0,0,0)%*%fixef(hier3))#wide
m<-invlogit(cbind(1,0,0,0,0,0,0)%*%fixef(hier3))#medium
n<-invlogit(cbind(1,0,1,0,0,0,0)%*%fixef(hier3))#narrow
I become stuck when trying to predict the CI of these values.
I was wondering if anyone has any ideas either how to calculate the CI OR any better ways to present the data.
Many thanks,
Anna
The University of Aberdeen is a charity registered in Scotland, No SC013683.
More information about the R-sig-mixed-models
mailing list