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.
mp_bootstrap(
data,
fun = rile,
col_filter = "^per(\\d{3}|\\d{4}|uncod)$",
statistics = list(sd),
N = 1000,
ignore_na = TRUE,
rescale = TRUE,
...
)
A data.frame with cases to be scaled and bootstrapped
function of a data row the bootstraped distribution of which is of interest
Regular expression matching the column names that should be
permuted for the resampling (usually and by default the handbook v4_categories
(plus cee_categories
) per variables)
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.
number of resamples to use for bootstrap distribution
if TRUE (default), for each observation drop silently the columns that have an NA value for the permutation
if TRUE (default), rescale the permuted values after the permutation to the sum of the values of the col_filter columns instead of 100
more arguments passed on to fun
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