-
Notifications
You must be signed in to change notification settings - Fork 80
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
success argument for prop_test #343
Comments
I agree, especially since |
Ah, agreed! Giving this a go right now. :-) |
Note about how mosaic processes this: If you specify prop.test( ~ resample(LETTERS[1:4], size = 100), success = "A", p = 0.25)
##
## 1-sample proportions test with continuity correction
##
## data: $resample(LETTERS[1:4], size = 100) [with success = A]
## X-squared = 0.12, df = 1, p-value = 0.729
## alternative hypothesis: true p is not equal to 0.25
## 95 percent confidence interval:
## 0.1883648 0.3696071
## sample estimates:
## p
## 0.27 Is that how |
In I usually think of these wrappers as just providing a tidy interface to the analogous function from Just put in a PR (linked above)! A demo of how this could look: library(infer)
# one-sample (note that p != .5)
prop_test(gss,
college ~ NULL,
p = .2,
success = "degree")
#> # A tibble: 1 x 4
#> statistic chisq_df p_value alternative
#> <dbl> <int> <dbl> <chr>
#> 1 67.5 1 2.08e-16 two.sided
prop_test(gss,
college ~ NULL,
p = .2,
success = "no degree")
#> # A tibble: 1 x 4
#> statistic chisq_df p_value alternative
#> <dbl> <int> <dbl> <chr>
#> 1 636. 1 2.98e-140 two.sided
prop_test(gss,
college ~ NULL,
p = .8,
success = "degree")
#> # A tibble: 1 x 4
#> statistic chisq_df p_value alternative
#> <dbl> <int> <dbl> <chr>
#> 1 636. 1 2.98e-140 two.sided
# two-sample
prop_test(gss,
college ~ sex,
order = c("female", "male"),
success = "degree")
#> # A tibble: 1 x 6
#> statistic chisq_df p_value alternative lower_ci upper_ci
#> <dbl> <dbl> <dbl> <chr> <dbl> <dbl>
#> 1 0.0000204 1 0.996 two.sided -0.0917 0.101
prop_test(gss,
college ~ sex,
order = c("female", "male"),
success = "no degree")
#> # A tibble: 1 x 6
#> statistic chisq_df p_value alternative lower_ci upper_ci
#> <dbl> <dbl> <dbl> <chr> <dbl> <dbl>
#> 1 0.0000204 1 0.996 two.sided -0.101 0.0917
prop_test(gss,
college ~ sex,
order = c("male", "female"),
success = "degree")
#> # A tibble: 1 x 6
#> statistic chisq_df p_value alternative lower_ci upper_ci
#> <dbl> <dbl> <dbl> <chr> <dbl> <dbl>
#> 1 0.0000204 1 0.996 two.sided -0.101 0.0917 Created on 2020-12-03 by the reprex package (v0.3.0.9001) |
This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue. |
It would be nice to have a
success
argument forprop_test
, analogous to the one frommosaic::prop.test
. Here's how it could be used:The text was updated successfully, but these errors were encountered: