ez (version 3.0-1)

ezPredict: Computes predicted values from the fixed effects of a mixed effects model

Description

This function computes the predicted values from the fixed effects of a mixed effects model.

Usage

ezPredict( 
	fit
	, to_predict = NULL
	, numeric_res = 0
)

Arguments

fit
Fitted lmer object.
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 to_predict. If to_predict is null and a numeric fixed effect is encountered in the fitted model, then predi

Value

  • A data frame containing the prediction value (and estimated variance of this value) for each cell in the fixed effects design.

See Also

ANT, ANT2, ezANOVA, ezBoot, ezBootPlot, ezCor, ezDesign, ezMixed, link{ezMixedRel}, ezPerm, ezPlot, ezPrecis, ezPredict, ezResample, ezStats, progress_time, progress_timeCI

Examples

Run this code
#Read in the ANT data (see ?ANT).
data(ANT)
head(ANT)

#fit a mixed effects model to the error rate data
er_fit = lmer(
	formula = error ~ cue*flank*group + (1|subnum)
	, family = binomial
	, data = ANT
)

#obtain the predictions from the model
er_preds = ezPredict(
	fit = er_fit
)

#compute 95% CI for each prediction
er_preds$lo = er_preds$value - qnorm(.975)*sqrt(er_preds$var)
er_preds$hi = er_preds$value + qnorm(.975)*sqrt(er_preds$var)


#visualize the predictions
ggplot(
	data = er_preds
	, mapping = aes(
		x = flank
		, y = value
		, ymin = lo
		, ymax = hi
	)
)+
geom_point(
	alpha = .75
)+
geom_line(
	alpha = .5
)+
geom_errorbar(
	alpha = .5
)+
facet_grid(
	cue ~ group
)+
labs(
	y = 'Error Rate (log odds)'
)

Run the code above in your browser using DataCamp Workspace