mp_bootstrap: Compute bootstrap distributions for scaling functions
Description
Bootstrapping of distributions of scaling functions as described by
Benoit, Mikhaylov, and Laver (2009). Given a dataset with percentages of CMP
categories, for each case the distribution of categories is resampled from
a multinomial distribution and the scaling function computed for the resampled
values. Arbitrary statistics of the resulting bootstrap distribution can be
returned, such as standard deviation, quantiles, etc.Usage
mp_bootstrap(data, fun = rile,
col_filter = "per((\\d{3}(_\\d)?)|\\d{4}|(uncod))",
statistics = list(sd), N = 1000, ...)
Arguments
data
A data.frame with cases to be scaled and bootstrapped
fun
function of a data row the bootstraped distribution of which is of interest
col_filter
Regular expression matching the column names that should be
permuted for the resampling (usually and by default ther per variables)
statistics
A list (!) of statistics to be computed from the bootstrap
distribution; defaults to standard deviation (sd
). Must be
functions or numbers, where numbers are interpreted as quantiles. N
number of resamples to use for bootstrap distribution
...
more arguments passed on to fun
References
Benoit, K., Laver, M., & Mikhaylov, S. (2009). Treating Words as Data with Error: Uncertainty in Text Statements of Policy Positions. American Journal of Political Science, 53(2), 495-513. http://doi.org/10.1111/j.1540-5907.2009.00383.x