estimate_down: Estimate Down Levels

View source: R/estimate.R

estimate_downR Documentation

Estimate Down Levels

Description

Non-geographic partner function to geo_estimate_down. Allows users to estimate down without the costly matching operation if they've already matched.

Usage

estimate_down(wts, value, group)

Arguments

wts

numeric vector. Defaults to 1. Typically population or VAP, as a weight to give each precinct.

value

numeric vector. Defaults to 1. Typically electoral outcomes, as a value to estimate down into blocks.

group

matches of length(wts) that correspond to row indices of value. Often, this input is the output of geo_match.

Value

numeric vector with each value split by weight

Examples

library(dplyr)
set.seed(1)
data(checkerboard)
counties <- checkerboard %>%
  group_by(id <= 32) %>%
  summarize(geometry = sf::st_union(geometry)) %>%
  mutate(pop = c(100, 200))
matches <- geo_match(checkerboard, counties)
estimate_down(wts = rep(1, nrow(checkerboard)), value = counties$pop, group = matches)

christopherkenny/geomander documentation built on Feb. 18, 2024, 7:58 p.m.