bootstrap_critical_cutoffs {segmag} | R Documentation |
Bootstrap critical segmentation magnitude
Description
Bootstraps critical segmentation magnitude values for a segmag
object under the null hypothesis that all key presses were randomly
distributed (uniformly) across the experiment (time_min to time_max).
Usage
bootstrap_critical_cutoffs(segmag, n_bootstrap, critical_probs,
segmag_substract = NULL, visualize = FALSE, save_as = NULL)
Arguments
segmag |
object of class |
n_bootstrap |
numeric, number of bootstrap iterations |
critical_probs |
numeric vector of probabilities, e.g. c(.95,.99) |
segmag_substract |
object of class |
visualize |
logical, visualize ordered maxima (and minima if segmag_substract is set) of bootstrapping iterations (Note: Enabling this option might require a lot of RAM with large data sets or large values of n_bootstrap) |
save_as |
character, filename where to save raw bootstrapping data and plot (optional) |
Details
During each bootstrapping iteration, the key presses are randomly distributed (drawn from uniform distribution ranging from time_min to time_max). Then, segmentation magnitude is calculated with those random key press times (note that ids are retained, that is each participant "makes" the same amount of key presses as in the original experiment). The local maxima in segmentation magnitude resulting from the random key press times are ordered according to their size. The largest maximum is kept.
The function returns the critical_probs
quantiles of the vector of those
largest maxima obtained across n_bootstap
iterations
This function can also be used to bootstrap the critical maxima and minima cutoffs of a difference function of two segmag objects. To do so, segmag and segmag_substract must be defined. All values will be related to the difference of segmag - segmag_substract (Keypress times in segmag and segmag_substract are randomized independently).
Value
critical segmentation magnitudes; If segmag_substract is NULL, then the return value is a numeric vector. Otherwise a list with critical maxima cutoffs and critical minima cutoffs is returned.
See Also
Examples
#see ?segmag for an example