Learn R Programming

ez (version 4.4-0)

ezBoot: Compute bootstrap resampled predictions

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

Usage

ezBoot( data , dv , wid , within = NULL , between = NULL , resample_within = TRUE , iterations = 1e3 , lmer = FALSE , lmer_family = gaussian , parallel = FALSE , alarm = FALSE )

Arguments

data
Data frame containing the data to be analyzed.
dv
Name of the column in data that contains the dependent variable. Values in this column must be numeric.
wid
Name of the column in data that contains the variable specifying the case/Ss identifier.
within
Names of columns in data that contain predictor variables that are manipulated (or observed) within-Ss. If a single value, may be specified by name alone; if multiple values, must be specified as a .() list.
between
Names of columns in data that contain predictor variables that are manipulated (or observed) between-Ss. If a single value, may be specified by name alone; if multiple values, must be specified as a .() list.
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, predictions are obtained via mixed effects modelling; if FALSE predictions are obtained via cell means.
lmer_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 expected to match your data. For example, if the data are binary outcomes (eg. accuracy), then use the binomial family. See lmer.
parallel
Logical. If TRUE, computation will be parallel, assuming that a parallel backend has been specified (as in library(doMC);options(cores=4);registerDoMC(). Likely only to work when running R from a unix terminal.)
alarm
Logical. If TRUE, call the alarm function when ezBoot completes.

Value

A list containing either two or three components: A list containing either two or three components:

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

link{ezANOVA}, ezMixed, ezPerm, ezPlot2, ezResample

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
)

## Not run: 
# #plot the full design
# p = ezPlot2(
#     preds = rt
#     , x = flank
#     , split = cue
#     , col = group
# )
# print(p)
# 
# #plot the effect of group across the flank*cue design
# p = ezPlot2(
#     preds = rt
#     , x = flank
#     , split = cue
#     , diff = group
# )
# print(p)
# 
# #plot the flank*cue design, averaging across group
# p = ezPlot2(
#     preds = rt
#     , x = flank
#     , split = cue
# )
# print(p)
# ## End(Not run)

Run the code above in your browser using DataLab