Compute predicted values from the fixed effects of a mixed effects model
This function computes the predicted values from the fixed effects of a mixed effects model.
ezPredict( fit , to_predict = NULL , numeric_res = 0 , boot = TRUE , iterations = 1e3 , zero_intercept_variance = FALSE )
fit |
Fitted |
to_predict |
Optional data frame containing the fixed effects design to predict. If absent, the function will assume that the full design from the provided fitted model is requested. |
numeric_res |
Integer value specifying the sampling resolution of any numeric fixed effect. Has no effect if non-NULL value supplied to |
boot |
Logical. If TRUE (default), bootstrapping will be used to generate sample predictions. |
iterations |
Integer value specifying the number of bootstrap iterations to employ if |
zero_intercept_variance |
Logical. If TRUE (default), bootstrap samples will be obtained after setting the intercept variance and covariances to zero. This makes sense only when, prior to fitting the model, the predictor variables were set up with contrasts that make the intercept orthogonal to effects of interest (e.g. |
A data frame containing the prediction value (and estimated variance of this value) for each cell in the fixed effects design.
Michael A. Lawrence mike.lwrnc@gmail.com
Visit the ez
development site at http://github.com/mike-lawrence/ez
for the bug/issue tracker and the link to the mailing list.
library(lme4) #Read in the ANT data (see ?ANT). data(ANT) head(ANT) #fit a mixed effects model to the rt data rt_fit = lmer( formula = rt ~ cue*flank*group + (1|subnum) , data = ANT[ANT$error==0,] ) #obtain the predictions from the model rt_preds = ezPredict( fit = rt_fit ) #visualize the predictions ezPlot2( preds = rt_preds , x = flank , row = cue , col = group , y_lab = 'RT (ms)' )
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.