Learn R Programming

redist (version 4.2.0)

competitiveness: Compute Competitiveness

Description

Currently only implements the competitiveness function in equation (5) of Cho & Liu 2016.

Usage

competitiveness(map, rvote, dvote, .data = cur_plans())

redist.competitiveness(plans, rvote, dvote, alpha = 1, beta = 1)

Value

Numeric vector with competitiveness scores

Arguments

map

a redist_map object

rvote

A numeric vector with the Republican vote for each precinct.

dvote

A numeric vector with the Democratic vote for each precinct.

.data

a redist_plans object

plans

A numeric vector (if only one map) or matrix with one row for each precinct and one column for each map. Required.

alpha

A numeric value for the alpha parameter for the talisman metric

beta

A numeric value for the beta parameter for the talisman metric

Examples

Run this code
data(fl25)
data(fl25_enum)

plans_05 <- fl25_enum$plans[, fl25_enum$pop_dev <= 0.05]
# old: comp <- redist.competitiveness(plans_05, fl25$mccain, fl25$obama)
comp <- compet_talisman(plans_05, fl25, mccain, obama)

Run the code above in your browser using DataLab