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

checks that N_tr > 40 for nonparametric bootstrap #63

Merged
merged 1 commit into from
Aug 2, 2021

Conversation

beniaminogreen
Copy link
Contributor

This pull request would add a safety check stopping the user from using the nonparametric bootstrap when there are fewer than 40
treated units. An alternate strategy could be to raise a warning instead of stopping the program.

I have created the PR because I have read a few papers which use the nonparametric bootstrap with just one or two treated units, in spite of the recommendations given by the documentation. Usage of the nonparametric bootstrap in this context generally seems to create standard-errors that over-exclude zero (at least in the monte carlo simulations I have run), so I think it would be useful for the program to give a warning or error to ensure that users are using the correct bootstrap procedure.

Comment on lines +276 to +281
# Do not attempt to use the parametric bootstrap if the number of treated units is fewer than 40
n_treated = length(unique(data[data[,D] == 1, index[1]]))
if (inference == "nonparametric" && n_treated < 40 && se) {
stop("Nonparametric bootstrap is inappropriate when there are fewer than 40 treated units")
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines check that the number of treated units is greater than 40 if the nonparametric bootstrap has been selected. Sorry about all the other edits; my editor automatically removes trailing whitespace.

@xuyiqing
Copy link
Owner

xuyiqing commented Jul 14, 2021 via email

Copy link
Collaborator

@liulch liulch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We believe this is useful. Thank you!

@liulch liulch merged commit b1bb198 into xuyiqing:master Aug 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants