kosukeimai / wru

Who Are You? Bayesian Prediction of Racial Category Using Surname and Geolocation
129 stars 30 forks source link

improper row sums on geo data #153

Closed ericmanning closed 3 months ago

ericmanning commented 4 months ago

line 185 in R/census_helper_v2.R reads:

geoPopulations <- rowSums(census[,names(census) %in% vars_])

The current version omits all Asian and Other vars in the geo population total computation (because the Asian and Other variable name vectors in vars_ have length > 1). Pr(R|G) calculations are incorrect as a result, and worse in places that have high proportions of Asian and Other individuals.

It should read:

geoPopulations <- rowSums(census[,names(census) %in% unlist(vars_)])

1beb commented 4 months ago

Thank you for reporting, we will take a look.

1beb commented 3 months ago

Closed by #154