Description Usage Arguments Value Author(s) See Also Examples
This function resamples data (useful when bootstrapping and used by ezBoot
).
1 2 3 4 5 6 7 8 9 |
data |
Data frame containing the data to be analyzed. |
wid |
.() object specifying the column in |
within |
Optional .() object specifying one or more columns in |
between |
Optional .() object specifying one or more columns in |
resample_within |
Logical. If TRUE, and if there are multiple observations per subject within each cell of the design specified by the factorial combination of variables supplied to |
resample_between |
Logical. If TRUE (default), levels of |
check_args |
Users should leave this as its default (TRUE) value. This argument is intended for internal use only. |
A data frame consisting of the resampled data
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | library(plyr)
#Read in the ANT data (see ?ANT).
data(ANT)
head(ANT)
ezPrecis(ANT)
#Bootstrap the within-cell variances
var_boots = ldply(
.data = 1:1e1 #1e3 or higher should be used for publication
, .fun = function(x){
this_resample = ezResample(
data = ANT[ANT$error==0,]
, wid = .(subnum)
, within = .(cue,flank)
, between = .(group)
)
cell_vars = ddply(
.data = idata.frame(this_resample)
, .variables = .(subnum,cue,flank,group)
, .fun = function(x){
to_return = data.frame(
value = var(x$rt)
)
return(to_return)
}
)
mean_cell_vars = ddply(
.data = idata.frame(cell_vars)
, .variables = .(cue,flank,group)
, .fun = function(x){
to_return = data.frame(
value = mean(x$value)
)
return(to_return)
}
)
mean_cell_vars$iteration = x
return(mean_cell_vars)
}
, .progress = 'time'
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.