Predicts, for one row in a voter file, the probability of a voter having a certain race by averaging over each "barrel" of the surname.
predict_race_multi_barreled(
voter_file,
surname_col = "last_name",
surname_only = TRUE,
census_data = NULL,
census_geo = "block",
surname_year = 2010,
use_age = FALSE,
use_sex = FALSE,
state = NULL,
county = NULL,
tract = NULL,
block = NULL,
pattern = "[ -]+",
remove_patterns = NULL
)
A vector of probabilities for each surname.
The voter file, with each row consisting of a voter.
A string denoting the surname column.
Whether to obtain probabilities for surnames only.
A data frame containing Census data corresponding to the geographic information for units in the voter file.
The census level at which to apply BISG. Passed to WRU.
Which Census year to use for surname matching. Passed to WRU.
Whether to use the age in the BISG calculation. Passed to WRU.
Whether to use the sex in the BISG calculation. Passed to WRU.
A string denoting the state for which the data is queried.
A string denoting the column containing the county FIPS code.
A string denoting the column containing the tract FIPS code.
A string denoting the column containing the block FIPS code.
What pattern to split surnames on. By default, surnames are split on a space(s), which assumes hyphens have already been removed.
A list of strings which will be removed from the list of barrels.