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

Fixes #107. No longer excludes samples with p_hat =0 #108

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

Conversation

mamcisaac
Copy link

The call to
filter(scientist_work == "Doesn't benefit")
is filtering out any replicates where there are no "Doesn't benefit"s in the small sample. As a result any replicates with p_hat=0 are filtered out and are not displayed.

This issue is caused by using a small sample size and a true proportion close to 0 (p=.2).

I have replaced this filtering code with the following

group_by(replicate)%>% summarize(p_hat = mean(scientist_work=="Doesn't benefit"))

Fixes #107.

mamcisaac and others added 7 commits October 31, 2022 15:23
The call to
filter(scientist_work == "Doesn't benefit")
is filtering out any replicates where there are no "Doesn't benefit"s in the small sample. As a result any replicates with p_hat=0 are filtered out and are not displayed.

This issue is caused by using a small sample size and a true proportion close to 0 (p=.2).

I have replaced this filtering code with the following

 group_by(replicate)%>% summarize(p_hat = mean(scientist_work=="Doesn't benefit"))

Fixes OpenIntroStat#107.
Replaces code based on filtering (which breaks down in the edge case where teh sample proporiton is 0, since there is then nothing to filter on) with code based on group_by + summarize.
…he lab to crash:

"Quitting from lines 70-76 (inf_for_categorical_data.Rmd)
Warning: Error in : A proportion is not well-defined for a multinomial categorical response variable (text_ind) and no explanatory variable."

text_ind contained "NA"s in addition to "yes"s and "no"s. This commit filters to complete cases (to eliminate the "NA"s).
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.

Lab 05a_sampling_distributions: replicates filtered out in sample_props_small
2 participants