Learn R Programming

PsumtSim (version 0.4)

catEffectBootAdaptor: Adaptor for testing category effects in simulations using the boot package and function.

Description

Adaptor for testing category effects in simulations using the boot package and function.

Usage

catEffectBootAdaptor(df, index, testFnc = sumSqCat, useResp = TRUE, ...)

Arguments

df
dataframe structured as that returned by simCatResp, with category, bkg, resp columns.
index
index for rearrangement of data as provided by boot function
testFnc
function to calculate test statistic based its first argument, using the category labels in the second argument, and passed the other arguments (...) given to this adaptor function.
useResp
true if the statistic should be calculated for the rearranged resp column of the dataframe, otherwise false to use the bkg column.
...
other arguments to pass to the testFnc

Value

value of the test statistic

See Also

boot

Examples

Run this code
  # Simulate 4 categories of responses and then compute the number of times
  # there would be a significant effect of a change in the categories relative
  # to background using the CBT. This would form a rough estimate of the power
  # of the CBT to detect such changes.
  library(boot)
  library(EffectsRelBaseline)
  simCatResp(1,c(1,1.5,2,1),6)->sim3
  boot(sim3,catEffectBootAdaptor,100,backMean=mean(1,1.5,2,1))->boot3
  sum(boot3$t0>boot3$t)

Run the code above in your browser using DataLab