infer_2mean() is an alternative to infer_2mean_test() and infer_2mean_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_2mean_test() (except change
the function name). For a confidence interval provided with that, use conf_int = "show.
Arguments
- data
A data frame (or tibble).
- formula
The variables to run the test on, in formula syntax,
var1 ~ var2.- 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.
- conf_int
Should a confidence interval be provided in addition to the hypothesis test output? Defaults to "hide" with the other option being "show".
- caption
An override to the table caption. A sensible default is provided.
Examples
infer_2mean(mtcars, wt~vs)
Two Sample Independent Means Test Between wt and vs
Confidence Level: 95%
p-value Reported: Two Sided
Total Observations: 32
Observations Used: 32 vs
n
Group
Means
Standard
Error
t
df
p-value
0
18
3.689
0.286
3.764
29.981
0.000728
1
14
2.611
infer_2mean(mtcars, wt~vs, conf_lvl = .9)
Two Sample Independent Means Test Between wt and vs
Confidence Level: 90%
p-value Reported: Two Sided
Total Observations: 32
Observations Used: 32 vs
n
Group
Means
Standard
Error
t
df
p-value
0
18
3.689
0.286
3.764
29.981
0.000728
1
14
2.611
infer_2mean(mtcars, wt~vs, conf_lvl = .9, conf_int = "show")
Two Sample Independent Means Test Between wt and vs
Confidence Level: 90%
p-value Reported: Two Sided
Total Observations: 32
Observations Used: 32 vs
n
Group
Means
Standard
Error
t
df
p-value
90%
Interval
Lower
90%
Interval
Upper
0
18
3.689
0.286
3.764
29.981
0.000728
0.591
1.563
1
14
2.611