modfuns | R Documentation |
These functions are intended for internal use only. Users should use the
predict_race()
interface rather any of these functions directly.
.predict_race_old(
voter.file,
census.surname = TRUE,
surname.only = FALSE,
surname.year = 2020,
name.dictionaries = NULL,
census.geo,
census.key = Sys.getenv("CENSUS_API_KEY"),
census.data = NULL,
age = FALSE,
sex = FALSE,
year = "2020",
party,
retry = 3,
impute.missing = TRUE,
use.counties = FALSE
)
predict_race_new(
voter.file,
names.to.use,
year = "2020",
age = FALSE,
sex = FALSE,
census.geo = c("tract", "block", "block_group", "county", "place", "zcta"),
census.key = Sys.getenv("CENSUS_API_KEY"),
name.dictionaries,
surname.only = FALSE,
census.data = NULL,
retry = 0,
impute.missing = TRUE,
skip_bad_geos = FALSE,
census.surname = FALSE,
use.counties = FALSE
)
predict_race_me(
voter.file,
names.to.use,
year = "2020",
age = FALSE,
sex = FALSE,
census.geo = c("tract", "block", "block_group", "county", "place", "zcta"),
census.key = Sys.getenv("CENSUS_API_KEY"),
name.dictionaries,
surname.only = FALSE,
census.data = NULL,
retry = 0,
impute.missing = TRUE,
census.surname = FALSE,
use.counties = FALSE,
race.init,
ctrl
)
voter.file |
See documentation in |
census.surname |
See documentation in |
surname.only |
See documentation in |
surname.year |
See documentation in |
name.dictionaries |
See documentation in |
census.geo |
See documentation in |
census.key |
A character object specifying user's Census API key.
Required if If |
census.data |
See documentation in |
age |
See documentation in |
sex |
See documentation in |
year |
See documentation in |
party |
See documentation in |
retry |
See documentation in |
impute.missing |
See documentation in |
use.counties |
A logical, defaulting to FALSE. Should census data be filtered by counties available in census.data? |
names.to.use |
See documentation in |
skip_bad_geos |
See documentation in |
race.init |
See documentation in |
ctrl |
See |
These functions fit different versions of WRU. .predict_race_old
fits
the original WRU model, also known as BISG with census-based surname dictionary.
.predict_race_new
fits a new version of BISG which uses a new, augmented
surname dictionary, and can also accommodate the use of first and middle
name information. Finally, .predict_race_me
fits a fully Bayesian Improved
Surname Geocoding model (fBISG), which fits a model with measurement-error
correction of erroneous zeros in census tables, in addition to also accommodating
the augmented surname dictionary, and the first and middle name
dictionaries when making predictions.
Output will be an object of class data.frame
. It will
consist of the original user-input voter.file
with additional columns with
predicted probabilities for each of the five major racial categories:
pred.whi
for White,
pred.bla
for Black,
pred.his
for Hispanic/Latino,
pred.asi
for Asian/Pacific Islander, and
pred.oth
for Other/Mixed.
Original WRU race prediction function, implementing classical BISG with census-based surname dictionary.
New race prediction function, implementing classical BISG with augmented surname dictionary, as well as first and middle name information.
New race prediction function, implementing fBISG (i.e. measurement error correction, fully Bayesian model) with augmented surname dictionary, as well as first and middle name information.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.