Repeats randomizations and scores summary statistics

Share:

Description

Repeats resampling/shuffling of dataframes and scores the values returned by user-define function which is applied to each randomized dataframe.

Usage

1
2
3
Rsampling(type = c("normal_rand", "rows_as_units", "columns_as_units",
  "within_rows", "within_columns"), dataframe, statistics, ntrials = 10000,
  simplify = TRUE, progress = "text", fix.zeroes = FALSE, ...)

Arguments

type

character; the name of the randomization function to be applied to dataframe. See randomization functions.

dataframe

a dataframe with the data to be shuffled or resampled.

statistics

a function that calculates the statistics of interest from the dataframe. The first argument should be the dataframe with the data and preferably should return a (named) vector, data frame, matrix or array.

ntrials

integer; number of randomizations to perform.

simplify

logical; should the result be simplified to a vector, matrix or higher dimensional array if possible?

progress

which kind of progress bar should be used (currently unimplemented!)

fix.zeroes

logical; for normal_rand, within_rows or within_columns, should zeroes in the dataframe be kept in place? See the help on zfsample for more details.

...

further arguments to be passed to the randomization functions (e.g., cols, replace, stratum).

Value

a list of objects returned by the function defined by statistics or a vector, matrix or array when simplify=TRUE and simplification can be done (see simplify2array).

Details

This function corresponds to Repeat and score in Resampling Stats add-in for Excel (www.resample.com). The randomization function defined by type is applied ntrials times on the data provided by dataframe. At each trial the function defined by argument statistics is applied to the resulting dataframe and the resulting objects are returned.

References

Statistics.com LCC. 2009. Resampling Stats Add-in for Excel User's Guide. http://www.resample.com/content/software/excel/userguide/RSXLHelp.pdf