This function assumes that the Census data is provided to the function. It does not provide the capability of downloading the Census data, since this is a time intensive process.
wru_predict_race_wrapper(
voter_file,
census_data,
voter_id = NULL,
surname = "last_name",
state = NULL,
county = NULL,
tract = NULL,
block = NULL,
census_geo = NULL,
use_surname = TRUE,
surname_only = FALSE,
surname_year = 2010,
use_age = FALSE,
use_sex = FALSE,
return_surname_flag = FALSE,
return_geocode_flag = FALSE,
verbose = FALSE
)
The voter file component extracted from the provided data frame, with additional surname/geocode flags, as well as a data frame race prediction.
The voter file, containing columns with a surname and potentially geographic information.
A data frame containing Census data corresponding to the geographic information for units in the voter file.
A string denoting the column containing voter ID. Default is NULL, if there is no voter ID in the file. In this case, a voter ID will be assigned.
A string denoting the column containing the surname.
A string denoting the column containing the state FIPS code.
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.
The census level at which to apply BISG. Passed to WRU.
Whether to use the surname in calculating race probabilities. Passed to WRU.
Whether to only use the surname in calculating race probabilities. 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.
If TRUE, returns a flag indicating whether the surnames matched.
If TRUE, returns a flag indicating whether the first level of geocode matched.
A flag indicating whether to print out status messages.
Imai and Khanna (2016) "Improving Ecological Inference by Predicting Individual Ethnicity from Voter Registration Records"