Learn R Programming

ez (version 2.0-0)

ezBoot: Function to compute bootstrap resampled predictions for each cell in a specified experimental design.

Description

This function is used to compute bootstrap resampled predictions for each cell in a specified experimental design, using either cell means or mixed effects modelling to obtain predictions. The results can be visualized using ezPlotBoot.

Usage

ezBoot(
    data
    , dv
    , wid
    , within = NULL
    , between = NULL
    , iterations = 1e3
    , lmer = TRUE
    , family = 'gaussian'
)

Arguments

data
Data frame containing the data to be analyzed.
dv
.() object specifying the column in data that contains the dependent variable. Values in this column must be numeric.
wid
.() object specifying the column in data that contains the variable specifying the case/Ss identifier.
within
Optional .() object specifying one or more columns in data that contain predictor variables that are manipulated (or observed) within-Ss.
between
Optional .() object specifying one or more columns in data that contain predictor variables that are manipulated (or observed) between-Ss.
iterations
Numeric value specifying the number of bootstrap iterations to complete.
lmer
Boolean specifying whether to obtain predictions via mixed effects modelling (TRUE; default) or via cell means (FALSE).
family
When obtaining predictions via mixed effects modelling (i.e. when lmer=TRUE), you must specify the residuals family. While the bootstrap is in theory non-parametric, it may be more powerful if you specify a family that might reasonably expect

Value

  • A list containing either two or three components:
  • fitIf predictions are obtained by mixed effects modelling, an link[lme4]{lmer} object consisting of the original mixed effects model
  • cellsA data frame containing predictions for each cell of the design.
  • bootsA data frame containing predictions for each cell of the design from each iteration of the bootstrap procedure.

Details

While within and between are both optional, at least one column of data must be provided to either within or between. Any numeric or character variables in data that are specified as either wid, within or between will be converted to a factor with a warning. Prior to running, dv is collapsed to a mean for each cell defined by the combination of wid, within or between.

See Also

lmer, ANT, ANT2, ezANOVA, ezBoot, ezCor, ezDesign, ezPerm, ezPlot, ezPlotBoot, ezPrecis, ezStats

Examples

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

#Run ezBoot on the accurate RT data
er = ezBoot(
    data = ANT
    , dv = .(error)
    , wid = .(subnum)
    , within = .(cue,flank)
    , between = .(group)
    , family = 'binomial'
    , iterations = 1e1 #1e3 or higher is best for publication
)

#convert the error rate predictions from the logit scale (the default binomial scale) to the % scale
er$cells$value = 100*plogis(er$cells$value)
er$boots$value = 100*plogis(er$boots$value)

#plot the full design
from_ezPlotBoot = ezPlotBoot(
	from_ezBoot = er
	, x = .(flank)
	, split = .(cue)
	, col = .(group)
)
print(from_ezPlotBoot$plot)

#plot the effect of group across the flank*cue design
from_ezPlotBoot = ezPlotBoot(
	from_ezBoot = er
	, x = .(flank)
	, split = .(cue)
	, diff = .(group)
)
print(from_ezPlotBoot$plot)

Run the code above in your browser using DataLab