Unlimited learning, half price | 50% off

Last chance! 50% off unlimited learning

Sale ends in


bisg (version 0.1.0)

compute_p_r_cond_s: Computes the probability a person is of a specific racial group, conditioned on surname.

Description

This is a utility function for performing BISG. It operates on a voter file, and utilizes WRU's function for calculating probability of race by surname.

Usage

compute_p_r_cond_s(
  voter_file,
  surname_col,
  surname_counts = NULL,
  surname_col_counts = "surname",
  race_cols = c("whi", "bla", "his", "asi", "oth"),
  impute_missing = TRUE
)

Value

A tibble with rows denoting voters and columns denoting the probability that each voter is of a particular racial group.

Arguments

voter_file

A tibble containing a list of voters (by row), and a column that denotes their surname.

surname_col

A string denoting which column contains the voter surname.

surname_counts

A dataframe denoting the frequency with which surnames correspond to different race/ethnicities. If NULL, the Census surname list is used with categories and merging functions from wru. The dataframe should contain one column with surnames (specified with the y surname_col_counts parameter) and one column for each race/ethnicity group (specified with the race_cols parameter).

surname_col_counts

A string denoting the column in the surname_counts tibble that refers to the geographic unit.

race_cols

name of race columns in surname_counts data.frame.

impute_missing

Boolean indicating weather to fill in missing names with mean probability across all surnames.