infer_2prop()
is an alternative to infer_2prop_test()
and infer_2prop_int()
. Rather than have
hypothesis test and confidence interval output split into two separate functions, you can now do it
in one. For just a hypothesis test, do nothing different from infer_2prop_test()
(except change
the function name). For a confidence interval provided with that, use conf_int = "show"
.
Usage
infer_2prop(
data,
formula,
success,
digits = 3,
conf_lvl = 0.95,
conf_int = c("hide", "show"),
caption = NULL
)
Arguments
- data
A data frame (or tibble).
- formula
The variables to run the test on, in formula syntax,
var1 ~ var2
.- success
The data value that constitutes a "success".
- digits
The number of digits to round table values to. Defaults to 3.
- conf_lvl
The confidence level of the interval, entered as a value between 0 and 1. Defaults to 0.95.
- conf_int
Should a confidence interval be provided in addition to the hypothesis test output? Defaults to "hide" with the other option being "show".
An override to the table caption. A sensible default is provided.
Examples
infer_2prop(mtcars, vs~am, success = 1)
Two Sample Proportion Test Between vs and am
Success: 1 | Confidence: 95% am
n
Successes
n
n
Missing
p̂
Standard
Error
z
p-value
(2 tail)
0
7
19
0
0.368
0.177
0.907
0.341
1
7
13
0
0.538
infer_2prop(mtcars, vs~am, success = 1, conf_lvl = .9, digits = 4)
Two Sample Proportion Test Between vs and am
Success: 1 | Confidence: 90% am
n
Successes
n
n
Missing
p̂
Standard
Error
z
p-value
(2 tail)
0
7
19
0
0.3684
0.1771
0.9069
0.3409
1
7
13
0
0.5385
infer_2prop(mtcars, vs~am, success = 1, conf_lvl = .9, digits = 5, conf_int = "show")
Two Sample Proportion Test Between vs and am
Success: 1 | Confidence: 90% am
n
Successes
n
n
Missing
p̂
Standard
Error
z
p-value
(1 tail)
90%
Interval
Lower
90%
Interval
Upper
0
7
19
0
0.36842
0.17710
0.90688
0.17047
-0.46134
0.12126
1
7
13
0
0.53846