scorer_group_pct {redist}R Documentation

Scoring functions for redist_shortburst

Description

The output of these functions may be passed into redist_shortburst() as score_fn. Scoring functions have type redist_scorer and may be combined together using basic arithmetic operations.

Usage

scorer_group_pct(map, group_pop, total_pop, k = 1)

scorer_pop_dev(map)

scorer_splits(map, counties)

scorer_multisplits(map, counties)

scorer_frac_kept(map)

scorer_polsby_popper(map, perim_df = NULL, areas = NULL, m = 1)

scorer_status_quo(map, existing_plan = get_existing(map))

Arguments

map

A redist_map object.

group_pop

A numeric vector with the population of the group for every precinct.

total_pop

A numeric vector with the population for every precinct.

k

the k-th from the top group fraction to return as the score.

counties

A numeric vector with an integer from 1:n_counties

perim_df

perimeter distance dataframe from prep_perims()

areas

area of each precinct (ie st_area(map))

m

the m-th from the bottom Polsby Popper to return as the score. Defaults to 1, the minimum Polsby Popper score

existing_plan

A vector containing the current plan.

Details

Function details:

Value

A scoring function of class redist_scorer which returns a single numeric value per plan. Larger values are generally better for frac_kept, group_pct, and polsby_popper and smaller values are better for splits and pop_dev.

Examples


data(iowa)
iowa_map <- redist_map(iowa, existing_plan = cd_2010, pop_tol = 0.05, total_pop = pop)

scorer_frac_kept(iowa_map)
scorer_status_quo(iowa_map)
scorer_group_pct(iowa_map, dem_08, tot_08, k = 2)
1.5*scorer_frac_kept(iowa_map) + 0.4*scorer_status_quo(iowa_map)
1.5*scorer_frac_kept(iowa_map) + scorer_frac_kept(iowa_map)*scorer_status_quo(iowa_map)
cbind(
    comp = scorer_frac_kept(iowa_map),
    sq = scorer_status_quo(iowa_map)
)



[Package redist version 4.2.0 Index]