Calculates individual probabilities of belonging to racial groups given last
name, location, and other covariates (optional). The standard function
bisg() treats the input tables as fixed. An alternative function
bisg_me(), assumes that the input tables are subject to measurement error,
and uses a Gibbs sampler to impute the individual race probabilities, using
the model of Imai et al. (2022).
bisg( formula, data = NULL, p_r = p_r_natl(), p_rgx = NULL, p_rs = NULL, save_rgx = TRUE ) bisg_me( formula, data = NULL, p_r = p_r_natl(), p_rgx = NULL, p_rs = NULL, iter = 1000, warmup = 100, cores = 1L ) # S3 method for bisg summary(object, p_r = NULL, ...) # S3 method for bisg predict(object, adj = NULL, ...)
A formula specifying the BISG model. Must include the special term
nm()to identify the surname variable. Certain geographic variables can be identified similarly:
zip()for ZIP codes, and
state()for states. If no other predictor variables are provided, then
bisg()will automatically be able to build a table of census data to use in inference. If other predictor variables are included, or if other geographic identifiers are used, then the user must specify the
p_rgxargument below. The left-hand side of the formula is ignored. See the examples section below for sample formulas.
The data frame containing the variables in
The prior distribution of race in the sample, as a numeric vector. Defaults to U.S. demographics as provided by
p_r_natl(). Can also set
"estimate"to estimate this from the geographic distribution. Since the prior distribution on race strongly affects the calibration of the BISG probabilities and thus the accuracy of downstream estimates, users are encouraged to think carefully about an appropriate value for
p_r. If no prior information on the racial makeup of the sample is available, and yet the sample is very different from the overall U.S. population, then
p_r="estimate"will likely produce superior results.
The distribution of race given location (G) and other covariates (X) specified in
formula. Should be provided as a data frame, with columns matching the predictors in
formula, and additional columns for each racial group containing the conditional probability for that racial group given the predictors. For example, if Census tracts are the only predictors,
p_rgxshould be a data frame with a tract column and columns
black, etc. containing the racial distribution of each tract. If
formulacontains only labeled terms (like
zip()), then by default
p_rgxwill be constructed automatically from the most recent Census data. This table will be normalized by row, so it can be provided as population counts as well. Counts are required for
census_race_geo_table()function can be helpful to prepare tables, as can be the
build_acs()functions in the
The distribution of race given last name. As with
p_rgx, should be provided as a data frame, with a column of names and additional columns for each racial group. Users should not have to specify this argument in most cases, as the table will be built from published Census surname tables automatically. Counts are required for
TRUE, save the
p_rgxtable (matched to each individual) as the
"gx"attributes of the output. Necessary for some sensitivity analyses.
How many sampling iterations in the Gibbs sampler
How many burn-in iterations in the Gibbs sampler
How many parallel cores to use in computation. Around 4 seems to be optimal, even if more are available.
An object of class
bisg, the result of running
Additional arguments to generic methods (ignored).
A point in the simplex that describes how BISG probabilities will be thresholded to produce point predictions. The probabilities are divided by
adj, then the racial category with the highest probability is predicted. Can be used to trade off types of prediction error. Must be nonnegative but will be normalized to sum to 1. The default is to make no adjustment.
An object of class
bisg, which is just a data frame with some
additional attributes. The data frame has rows matching the input data and
columns for the race probabilities.
summary(bisg): Summarize predicted race probabilities. Returns vector of individual entropies.
predict(bisg): Create point predictions of individual race. Returns factor vector of individual race labels. Strongly not recommended for any kind of inferential purpose, as biases may be extreme and in unpredictable directions.
Elliott, M. N., Fremont, A., Morrison, P. A., Pantoja, P., and Lurie, N. (2008). A new method for estimating race/ethnicity and associated disparities where administrative records lack self-reported race/ethnicity. Health Services Research, 43(5p1):1722–1736.
Fiscella, K. and Fremont, A. M. (2006). Use of geocoding and surname analysis to estimate race and ethnicity. Health Services Research, 41(4p1):1482–1500.
Imai, K., Olivella, S., & Rosenman, E. T. (2022). Addressing census data problems in race imputation via fully Bayesian Improved Surname Geocoding and name supplements. Science Advances, 8(49), eadc9824.
data(pseudo_vf) bisg(~ nm(last_name), data=pseudo_vf) #> # A tibble: 5,000 × 6 #> pr_white pr_black pr_hisp pr_asian pr_aian pr_other #> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 0.826 0.0701 0.0305 0.00353 0.0208 0.0491 #> 2 0.362 0.547 0.0298 0.00315 0.00454 0.0533 #> 3 0.918 0.00887 0.0397 0.00697 0.00223 0.0240 #> 4 0.620 0.293 0.0317 0.00379 0.00545 0.0460 #> 5 0.892 0.0237 0.0413 0.00831 0.00295 0.0322 #> 6 0.844 0.0790 0.0309 0.00384 0.00542 0.0370 #> 7 0.491 0.419 0.0297 0.00390 0.00548 0.0512 #> 8 0.982 0.00574 0.0120 0 0 0 #> 9 0.713 0.194 0.0319 0.00422 0.00695 0.0497 #> 10 0.593 0.337 0.0262 0.00278 0.00406 0.0368 #> # ℹ 4,990 more rows r_probs = bisg(~ nm(last_name) + zip(zip), data=pseudo_vf) summary(r_probs) #> BISG individual race probabilities #> #> Implied marginal race distribution: #> pr_white pr_black pr_hisp pr_asian pr_aian pr_other #> 0.641 0.215 0.074 0.020 0.007 0.043 #> #> Entropy decrease from marginal distribution: #> Min. 1st Qu. Median Mean 3rd Qu. Max. #> -0.5137 0.1193 0.3315 0.3665 0.6386 1.0563 head(predict(r_probs)) #>  white black white white white white #> Levels: white black hisp asian aian other data(pseudo_vf) bisg_me(~ nm(last_name) + zip(zip), data=pseudo_vf) #> # A tibble: 5,000 × 6 #> pr_white pr_black pr_hisp pr_asian pr_aian pr_other #> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 0.969 0.003 0.002 0 0.016 0.01 #> 2 0.196 0.783 0.009 0.003 0 0.009 #> 3 0.982 0 0.006 0.009 0 0.003 #> 4 0.647 0.317 0.0180 0.001 0.003 0.014 #> 5 0.985 0.001 0.005 0 0.002 0.007 #> 6 0.660 0.247 0.0510 0.006 0.008 0.0280 #> 7 0.181 0.758 0.0320 0.003 0.005 0.0210 #> 8 0.985 0.007 0.008 0 0 0 #> 9 0.817 0.166 0.003 0 0.001 0.013 #> 10 0.907 0.0750 0.006 0.003 0.002 0.007 #> # ℹ 4,990 more rows