predict_iii {i3pack}R Documentation

Predict II Score for a given set of electoral rule configurations

Description

Predict II Score for a given set of electoral rule configurations

Usage

predict_iii(
  data,
  score = c("TDE", "AP"),
  district_level = TRUE,
  return_avg = TRUE
)

Arguments

data

A data.frame containing the following variables: ballot_type (factor), pool_level (factor), votes_per_voter (factor), M (numeric), threshold (numeric), and formula (factor). See simulate_election() for more details.

score

Character string indicating type of score to predict; one of TDE (default) or AP.

district_level

Boolean: Should district level, or country level models be used? If TRUE (default), the function uses district level models, which are more accurate for district-level electoral systems. If FALSE, the function uses country-level models, which are more accurate for country-level electoral systems.

return_avg

Boolean: Should the average score across imputed models be returned? The original models were trained on millions of simulated elections, with intermediate values for some parameters interpolated using 5 multiple imputations. If TRUE (default), the function returns the average score across all imputations. If FALSE, the function returns a list of scores.

Value

Predicted TDE or AP score for given electoral system

Examples

## Create example data for PR system with closed party lists,
## magnitude 5, and Droop quota
new_system <- data.frame(ballot_type = as.factor("closed"),
                         pool_level = as.factor("party"),
                         votes_per_voter = as.factor("One"),
                         M = 5.0,
                         threshold = 0.05,
                         formula = as.factor("droop"))
predict_iii(data = new_system, score = "AP", district_level = FALSE)


[Package i3pack version 0.1.0 Index]