# Uncertainty Estimates

We provide software to calculate two different uncertainty measures that can be applied to all content analytical variables in the dataset.

## Error estimates based on party changes

manifestata (our stata add-on) allows the calculation of these uncertainty estimates. See the manifestata page on how to install manifestata.

The function is called mp_uncertainty and allows one variable as argument. To calculate uncertainty estimates for the rile, just type:

``` mp_uncertainty rile ```

The function will create five variables at the end of the dataset:

``` rile_firststageSEM rile_secondstageSEM rile_rho1 rile_rho2 rile_outlier ```

The function can also be applied to other variables, to get uncertainty measures for single variables, eg:

``` mp_uncertainty per501 ```

As these estimates are based on parties' changes over time, it is not possible to compute these estimates for variables that are observed only once.

## Bootstrapped confidence intervals

Benoit, Laver and Mikhaylov (2009) suggested to bootstrap the distribution of codes to get a measure of uncertainty. Please read the article for more details on the methodology.

manifestoR (our R package) facilitates the calculation of these uncertainty estimates. Please consult the manifestoR page on installation instructions.

The function to calculate bootstrapped confidence intervals is called mp_bootstrap. To calculate uncertainty estimates for the rile, just type:

``` mp_bootstrap(data, fun = rile) ```

Note that the argument fun can be any scaling function and the returned data.frame containes the scaled position as well as the bootstrapped standard deviations. You can easily write your own scaling functions, eg:

``````custom_scale <- function(data) {
data\$per402 - data\$per401
}
``````

You can also change the additional parameters statistics. to compute several statistics from the bootstrapped distribution, such as variance or quantiles:

``````mp_bootstrap(data,
fun = custom_scale,
statistics = list(var, 0.025, 0.975))
``````

## 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. DOI: 10.1111/j.1540-5907.2009.00383.x

McDonald, M. D., & Budge, I. (2014). Getting it (approximately) right (and center and left!): Reliability and uncertainty estimates for the comparative manifesto data. Electoral Studies, 35, 67–77. doi: 10.1016/j.electstud.2014.04.017