Learn R Programming

ez (version 3.0-1)

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 ezBootPlot.

Usage

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

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.
resample_within
Logical value specifying whether to resample within each cell of the design within each wid unit. If there is only one observation per such cells, then this should be set to FALSE to avoid useless computation.
iterations
Numeric value specifying the number of bootstrap iterations to complete.
lmer
Logical. If TRUE (default), predictions are obtained via mixed effects modelling; if FALSE predictions are obtained via cell means.
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
alarm
Logical. If TRUE (default), call the alarm function when ezBoot completes.

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

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)
ezPrecis(ANT)

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

#plot the full design
from_ezBootPlot = ezBootPlot(
    from_ezBoot = rt
    , x = .(flank)
    , split = .(cue)
    , col = .(group)
)
print(from_ezBootPlot$plot)

#plot the effect of group across the flank*cue design
from_ezBootPlot = ezBootPlot(
    from_ezBoot = rt
    , x = .(flank)
    , split = .(cue)
    , diff = .(group)
)
print(from_ezBootPlot$plot)

#plot the flank*cue design, averaging across group
from_ezBootPlot = ezBootPlot(
    from_ezBoot = rt
    , x = .(flank)
    , split = .(cue)
)
print(from_ezBootPlot$plot)

Run the code above in your browser using DataLab