get_prediction {variancePartition} | R Documentation |
Compute predicted value of formula for linear mixed model for with lmer
get_prediction(fit, formula)
fit |
model fit with lmer |
formula |
formula of fixed and random effects to predict |
Similar motivation as lme4:::predict.merMod()
, but that function cannot use just a subset of the fixed effects: it either uses none or all. Note that the intercept is included in the formula by default. To exclude it from the prediction use ~ 0 + ...
syntax
Predicted values from formula using parameter estimates from fit linear mixed model
library(lme4) # fit model fm1 <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy) # predict Days, but exclude intercept get_prediction( fm1, ~ 0 + Days) # predict Days and (Days | Subject) random effect, but exclude intercept get_prediction( fm1, ~ 0 + Days + (Days | Subject))