[R] GLMM: measure for significance of random variable?
Spencer Graves
spencer.graves at pdf.com
Thu Dec 1 18:26:54 CET 2005
1. To evalute the significance of "the random variable" (a random
effect?) using 'lmer', have you considered fitting models with and
without that effect, as in the example with 'example(lmer)'?
2. Regarding 'predict.lmer', I tried the following:
> predict(fm1)
Error in predict(fm1) : no applicable method for "predict"
> predict.glm(fm1)
NULL
However, ' RSiteSearch("predict lmer")' produced 9 hits for me, the
first of which indicated that glmmPQL in library(MASS) had a predict
method (http://finzi.psych.upenn.edu/R/Rhelp02a/archive/62139.html).
3. I can't tell you why the "Laplace" method didn't work with all
your models, but I can guess: Do you know if the model is even
estimable? As a partial test for that, have you tried estimating the
same fixed effects with "glm", something like the following:
model4b0 <- glm(RESPONSE~ D_TO_FORAL +
+ I((DIST_GREEN-300)*(DIST_GREEN<300))+
+ I((DIST_WATER-200)*(DIST_WATER<200)) +
+ I((DIST_VILL-900)*(DIST_VILL<900)) +
+ I((DIST_HOUSE-200)*(DIST_HOUSE<200)), family=binomial)
[or 'family=quasibinomial']
If this fails to give you an answer, it says there is something in
the model that is not estimable. I might further try the same thing in
"lm":
model4b00 <- lm(RESPONSE~ D_TO_FORAL +
+ I((DIST_GREEN-300)*(DIST_GREEN<300))+
+ I((DIST_WATER-200)*(DIST_WATER<200)) +
+ I((DIST_VILL-900)*(DIST_VILL<900)) +
+ I((DIST_HOUSE-200)*(DIST_HOUSE<200)))
If this fails also, you can at least add 'singular.ok=TRUE' to find
out what "lm" will estimate.
If this doesn't answer the question, I suggest you work to develop
this simplest, self-contained example you can think of that will
replicate the problem, then send that to this listserve, as suggested in
the posting guide! 'www.R-project.org/posting-guide.html'. It's much
easier for someone else to diagnose a problem if they can replicate it
on their own computer in a matter of seconds.
hope this helps.
spencer graves
nina klar wrote:
> Hi,
>
> I have three questions concerning GLMMs.
> First, I ' m looking for a measure for the significance of
the random variable in a glmm. I'm fitting a glmm (lmer) to
telemetry-locations of 12 wildcat-individuals against random
locations (binomial response). The individual is the random
variable. Now I want to know, if the individual ("TIER") has
a significant effect on the model outcome. Does such a measure
exist in R?
> My second question is, if there is a "predict"-function for
glmms in R? Because I would like to produce a predictive
habitat-map (someone asked that before, but I think there
was no answer so far).
> And the third, why the method "laplace" doesn't work with all my models.
>
> thank you very much
>
> nina klar
>
>
>
>
> R output for a model, which works with laplace:
>
>
>>model4a<-lmer(RESPONSE~ D_TO_FORAL +
>
> + I((DIST_WATER-200)*(DIST_WATER<200)) +
> + I((DIST_VILL-900)*(DIST_VILL<900)) +
> + (1|TIER), family=binomial, method="Laplace")
>
>>summary(model4a)
>
> Generalized linear mixed model fit using Laplace
> Formula: RESPONSE ~ D_TO_FORAL + I((DIST_WATER - 200) * (DIST_WATER < 200)) + I((DIST_VILL - 900) * (DIST_VILL < 900)) + (1 | TIER)
> Family: binomial(logit link)
> AIC BIC logLik deviance
> 3291.247 3326.739 -1639.623 3279.247
> Random effects:
> Groups Name Variance Std.Dev.
> TIER (Intercept) 5e-10 2.2361e-05
> # of obs: 2739, groups: TIER, 12
>
> Estimated scale (compare to 1) 1.476153
>
> Fixed effects:
> Estimate Std. Error z value Pr(>|z|)
> (Intercept) 0.19516572 0.05812049 3.3580 0.0007852 ***
> D_TO_FORAL -0.01091458 0.00113453 -9.6204 < 2.2e-16 ***
> I((DIST_WATER - 200) * (DIST_WATER < 200)) -0.00551492 0.00061907 -8.9084 < 2.2e-16 ***
> I((DIST_VILL - 900) * (DIST_VILL < 900)) 0.00307265 0.00025708 11.9521 < 2.2e-16 ***
> ---
> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
>
> Correlation of Fixed Effects:
> (Intr) D_TO_F I-2*(<2
> D_TO_FORAL -0.247
> I((DI-2*(<2 0.561 -0.023
> I((DI-9*(<9 0.203 0.047 -0.206
>
>
> here is the R-output for a model which doesn't work with laplace:
>
>
>>model4b<-lmer(RESPONSE~ D_TO_FORAL +
>
> + I((DIST_GREEN-300)*(DIST_GREEN<300))+
> + I((DIST_WATER-200)*(DIST_WATER<200)) +
> + I((DIST_VILL-900)*(DIST_VILL<900)) +
> + I((DIST_HOUSE-200)*(DIST_HOUSE<200)) +
> + (1|TIER), family=binomial, method="Laplace")
> Fehler in optim(PQLpars, obj, method = "L-BFGS-B", lower = ifelse(const, :
> non-finite finite-difference value [7]
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA
spencer.graves at pdf.com
www.pdf.com <http://www.pdf.com>
Tel: 408-938-4420
Fax: 408-280-7915
More information about the R-help
mailing list