r - Predicted(?) values from an lmer model -
i have data frame of bird counts. have participants id number, number of birds counted, year counted them, lat , long coordinates, , effort. have made model:
model = lmer(count~year+lat+long+effort+(1|participant), data = df)
i want model plot predicted values same data set. so, data 1997-2017, , want model give me predicted values each year. want plot these, final plot have predicted count on y-axis, , year (categorical) on x-axis. each year have 1 data point w/ confidence interval.
i have tried figuring out predict()
, i'm not quite sure how use want. seems need new data frame, don't have new data set run through model predict future count. want model go , work on previous data put already, based off of beta values in output of summary(model)
.
i found thread, , seems i'm looking do, can't sjplot
dependencies download, sjlabelled
throws error every time: how plot predicted values standard errors lmer model results?
you try ggeffects-package, used in forthcoming sjplot-update plot predicted values.
library(ggeffects) dat <- ggpredict(model, terms = "dat") plot(dat)
if you're missing dependencies, try:
install.packages( c("sjlabelled", "sjmisc", "sjstats", "ggeffects", "sjplot"), dependencies = true )
you may want install ggeffects github, since current dev-version has fixes , improvements mixed models.
devtools::install_github("strengejacke/ggeffects")
Comments
Post a Comment