Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

predict_race() occasionally returns NaN #94

Closed
mrhumanzee opened this issue Jan 15, 2023 · 0 comments
Closed

predict_race() occasionally returns NaN #94

mrhumanzee opened this issue Jan 15, 2023 · 0 comments
Assignees
Labels

Comments

@mrhumanzee
Copy link

mrhumanzee commented Jan 15, 2023

I am imputing the race of individuals in a relatively large dataset (100,000+ observations) using first name, surname, and county. For around 40 observations, the function predict_race() returned NaN. I don't understand the implementation of wru well enough to understand why this occurred, but I have provided code below that allows the problem to be reproduced. The 'John Smith' observation was included to show that this problem does not necessarily affect every observation in the data frame. Also, changing the combination of first name and surname for a given observation may affect whether NaN is returned.

df1= data.frame(first=c("T-Yvette", "Loddy", "Bitta", "Rayka", "John"),
           surname=c("Soutiere", "Tolzmann", "Mostofi", "Belova", "Smith"),
           state=c("AK", "MN", "NY", "NY", "NY"),
           county=c("110", "053", "047", "061", "061"))

df1=predict_race(voter.file = df1, census.geo = "county",
                                   census.key = yourkey,
                                   impute.missing = F, names.to.use="surname, first")
df1


df2= data.frame(first=c("T-Yvette", "Loddy", "Bitta", "Rayka", "John"),
                surname=c("Smith", "Tolzmann", "Mostofi", "Belova", "Smith"),
                state=c("AK", "MN", "NY", "NY", "NY"),
                county=c("110", "053", "047", "061", "061"))

df2=predict_race(voter.file = df2, census.geo = "county",
                 census.key = yourkey,
                 impute.missing = F, names.to.use="surname, first")
df2
@solivella solivella added the bug label Sep 7, 2023
@solivella solivella self-assigned this Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants