[R] significance of random effects in poisson lmer
Wilson, Mark
mark.wilson at ucc.ie
Fri Aug 29 13:23:21 CEST 2008
Hi,
I am having problems trying to assess the significance of random terms
in a generalized linear mixed model using lme4 package. The model
describes bird species richness R along roads (offset by log length of
road log_length) as a function of fixed effects Shrub (%shrub cover) and
Width (width of road), and random effect Site (nested within Site
Cluster).
>From reading answers to previous posts, it seems that the consensus is
to derive p-values using the neat little piece of code posted by Doug
Bates as "mcmcpvalue". This code calls the merMCMC object created by the
function mcmcsamp, but I can't even get as far as using this function
without running into difficulty. Basically, I get an error message
saying "Error in .local(object, n, verbose, ...) : Update not yet
written" - see below for complete code.
Does anyone know why I am getting this error message and what if
anything I can do to address the problem? I am aware that p-values
derived via MCMC in this way can problematic when used with models that
incorporate offsets. However, I get the same error message if I take the
offset out of the model. The only way I can get mcmcsamp to run is to
leave out the specification of the model as poisson. However, I'm pretty
sure I don't want to do this.
Provided someone can tell me what I'm doing wrong, and I am able to
generate my MCMC sample, are there any work-arounds the problems people
have encountered using mcmcpvalue on models with offsets? Could I
control for the effect of road length on bird species richness by using
residuals from the relationship between the R and log_length as my
response variable? If not, then how can one estimate the significance
values of random effects of lmer models with offsets?
Very grateful for any suggestions,
Mark
>
model<-lmer(R~Shrub+width+(1|Cluster/Site)+offset(log_length),family=poi
sson)
> summary(model)
Generalized linear mixed model fit by the Laplace approximation
Formula: R ~ Shrub + width + (1 | Cluster/Site) + offset(log_length)
AIC BIC logLik deviance
59.76 70.56 -24.88 49.76
Random effects:
Groups Name Variance Std.Dev.
Site:Cluster (Intercept) 2.9878e-12 1.7285e-06
Cluster (Intercept) 0.0000e+00 0.0000e+00
Number of obs: 64, groups: Site:Cluster, 12; Cluster, 2
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -3.908504 0.198535 -19.687 < 2e-16 ***
Shrub 0.016509 0.004355 3.791 0.000150 ***
width -0.016435 0.009779 -1.681 0.092812 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Correlation of Fixed Effects:
(Intr) Shrub
Shrub -0.040
width -0.881 -0.322
> samp<-mcmcsamp(model,50000)
Error in .local(object, n, verbose, ...) : Update not yet written
>
More information about the R-help
mailing list