Create a summary table for a two-sample proportion test
Usage
infer_2prop_test(
data,
formula,
success,
digits = 3,
conf_lvl = 0.95,
alternative = c("notequal", "greater", "less"),
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.
- alternative
The alternative hypothesis. Defaults to "notequal" (two sided p-value). Other options include "greater" or "less". Use depends on your test.
- caption
An override to the table caption. A sensible default is provided.
Value
An object of class flextable. In an interactive environment, results are viewable immediately.
Examples
infer_2prop_test(mtcars, vs~am, success = 1)
Two Sample Proportion Test Between vs and am
Successes: 1
p-value Reported: Two Sided Variable
n
Successes
n
n
Missing
p̂
Standard
Error
z
p-value
0
7
19
0
0.368
0.177
0.907
0.341
1
7
13
0
0.538
infer_2prop_test(mtcars, vs~am, success = 1, alternative = "less")
Two Sample Proportion Test Between vs and am
Successes: 1
p-value Reported: One Sided (Less Than) Variable
n
Successes
n
n
Missing
p̂
Standard
Error
z
p-value
0
7
19
0
0.368
0.177
0.907
0.17
1
7
13
0
0.538
infer_2prop_test(mtcars, vs~am, success = 1, conf_lvl = .9, digits = 4)
Two Sample Proportion Test Between vs and am
Successes: 1
p-value Reported: Two Sided Variable
n
Successes
n
n
Missing
p̂
Standard
Error
z
p-value
0
7
19
0
0.3684
0.1771
0.9069
0.3409
1
7
13
0
0.5385