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

Add documentation clarifying appropriate use of weights in slice_sample() #7052

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

apeterson91
Copy link

@apeterson91 apeterson91 commented Jul 14, 2024

Users may be led astray by the current language describing weighted sampling via slice_sample(). As discussed in https://stats.stackexchange.com/q/639211/ and elaborated on in issue #6848, there's more nuance to how weights might be used for sampling. The current base R algorithm which slice_sample() relies on does not use the sampling weights in a way that conform to how a user might suspect the weights ought to work, as in Horvitz Thompson estimation for example.

I've added appropriate details here in the documentation including the above link for further details.

@etiennebacher
Copy link

Hi, I'm not a member of the tidyverse team, but I just want to point out that you need to redocument the package to include this change in the .Rd file. You can use devtools::document(), or comment "/document" (without the quotes) in this PR to trigger a github action workflow (I'm not sure the latter will work).

@apeterson91
Copy link
Author

apeterson91 commented Jul 17, 2024

Thanks @etiennebacher! Been a bit since I've built an R package locally – appreciate the reminder.

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.

None yet

2 participants