mp_bootstrap {manifestoR} | R Documentation |
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{4}|uncod)$",
statistics = list(sd),
N = 1000,
ignore_na = TRUE,
rescale = TRUE,
...
)
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 the handbook |
statistics |
A list (!) of statistics to be computed from the bootstrap
distribution; defaults to standard deviation ( |
N |
number of resamples to use for bootstrap distribution |
ignore_na |
if TRUE (default), for each observation drop silently the columns that have an NA value for the permutation |
rescale |
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 |
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