calibration: Calibration

Description Usage Arguments Details Value See Also

Description

The functions calibration_party and calibration_prop perform simulation from past election results, fit a model calling (mrp_party_estimation or mrp_estimation) for each simulation and return posterior simulations along actual outcomes, these can later be used to compute calibration summaries with the corresponding function: summary_calibration_party or summary_calibration. calibration_party is useful to calibrate individual models of total votes for a given party and calibration_prop is useful to analyse estimates for proportion of votes per party.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
calibration_party(data, party, stratum, frac = 1, n_iter = 2000,
  n_burnin = 500, n_chains = 3, seed = NA, cl_cores = 14, n_rep = 5,
  model_string = NULL)

calibration_prop(data, ..., stratum, frac = 1, n_iter = 2000,
  n_burnin = 500, n_chains = 3, seed = NA, cl_cores = 3, n_rep = 5,
  model_string = NULL, num_missing_strata = 0)

summary_calibration_party(calib_run_party, alpha_r = 0.05)

summary_calibration(calib_run, alpha_r = 0.05)

Arguments

data

A data.frame with variables: ln_total, region, distrito_loc_17, tamano_md, tamano_gd, casilla_ex and the column with number of votes for the party.

party

Unquoted variable indicating the column from the data.frame to be modeled.

stratum

If sampling the data, unquoted variable indicating the column from the data.frame to be used as strata. The strata will also be used in the hierarchical structure of the model.

frac

If sampling the data, numeric value indicating the fraction of the data to sample, the sample is selected using stratified sampling with probability proportional to size.

n_iter

Number of iterations, burnin size and chains. to be used in jags.

n_burnin

Number of iterations, burnin size and chains. to be used in jags.

n_chains

Number of iterations, burnin size and chains. to be used in jags.

seed

An integer vector of length 7 to be send to clusterSetRNGStream.

cl_cores

Number of cores, parameter is used in makeCluster.

n_rep

Number of repetitions of sample selection and model fitting.

model_string

String indicating the model to fit.

alpha_r

Calibration examines coverage of (1-alpha_r)*100 intervals.

Details

The functions are computationally demanding, they were designed to run on computers with more than 16 cores.

Value

data.frame with posterior simulation of total votes (if using calibration_party) or proportions (if using calibration_prop) for each repetiton of sample selection and model fitting.

See Also

mrp_estimation, mrp_party_estimation


tereom/quickcountmx documentation built on Dec. 2, 2019, 9:58 p.m.