Travis:  I wonder if you can modify the example from predict.lm to do
something comparable (saw this posting recently) with mixed effects models
from glmer().

?predict.lm

Offers this example, which seems to meet the request

x <- rnorm(15)
y <- x + rnorm(15)
predict(lm(y ~ x))
new <- data.frame(x = seq(-3, 3, 0.5))
predict(lm(y ~ x), new, se.fit = TRUE)
pred.w.plim <- predict(lm(y ~ x), new, interval = "prediction")
pred.w.clim <- predict(lm(y ~ x), new, interval = "confidence")
matplot(new$x, cbind(pred.w.clim, pred.w.plim[,-1]),
        lty = c(1,2,2,3,3), type = "l", ylab = "predicted y")


Brian

Brian S. Cade, PhD

U. S. Geological Survey
Fort Collins Science Center
2150 Centre Ave., Bldg. C
Fort Collins, CO  80526-8818

email:  ca...@usgs.gov <brian_c...@usgs.gov>
tel:  970 226-9326



On Thu, Feb 27, 2014 at 12:48 PM, Travis Belote <travis_bel...@tws.org>wrote:

> Hi all,
>
> I'm wondering if someone can help me figure out how to produce plots of
> model fits that include 95% CI bands for a generalized linear mixed model.
> I'm using glmer in lme4 to run essentially an ANCOVA to investigate a
> three-way interaction between one categorical variable (3 different
> species) and 2 continuous variables to investigate survival probability (0
> or 1) of trees.
>
> I've found a 3-way interaction between these variables. I have produced a
> stacked graph showing how the survival probabilities for different species
> (3 different lines) vary across a gradient of one of the variable and at 2
> levels of one of the other variables (shown by 2 panels). I used the
> parameter estimates to produce the predicted models as line graphs, but I'd
> like to add a confidence band around the models. I've been looking in Zuur
> et al's "Mixed effects models and extensions in ecology in R", but wonder
> if someone has a trick to doing this.
>
> Thanks for any insights!
> Travis
>
>
> Travis Belote, Ph.D.
> Research Ecologist
> The Wilderness Society | Northern Rockies Regional Office
> 503 W. Mendenhall, Bozeman, MT 59715
> office: 406.586.1600 x110 | cell: 406.581.3808
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology

Reply via email to