Skip to contents

Create a summary table for a two-sample mean test

Usage

infer_2mean_test(
  data,
  formula,
  digits = 3,
  mu0 = 0,
  alternative = c("notequal", "greater", "less"),
  conf_lvl = 0.95,
  caption = NULL
)

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.

mu0

The null hypothesis value. Defaults to 0.

alternative

The alternative hypothesis. Defaults to "notequal" (two sided p-value). Other options include "greater" or "less". Use depends on your test.

conf_lvl

The confidence level of the interval, entered as a value between 0 and 1. Defaults to 0.95.

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_2mean_test(mtcars, wt~vs)
Two Sample Independent Means Test Between wt and vs
Null Hypothesis Value (Difference in Means): 0
p-value Reported: Two Sided

Variable

n

n
Missing

Group
Means

Standard
Error

t

df

p-value

0

18

0

3.689

0.286

3.764

29.981

0.000728

1

14

0

2.611

infer_2mean_test(mtcars, wt~vs, alternative = "greater")
Two Sample Independent Means Test Between wt and vs
Null Hypothesis Value (Difference in Means): 0
p-value Reported: One Sided (Greater Than)

Variable

n

n
Missing

Group
Means

Standard
Error

t

df

p-value

0

18

0

3.689

0.286

3.764

29.981

0.000364

1

14

0

2.611

infer_2mean_test(mtcars, wt~vs, conf_lvl = .9)
Two Sample Independent Means Test Between wt and vs
Null Hypothesis Value (Difference in Means): 0
p-value Reported: Two Sided

Variable

n

n
Missing

Group
Means

Standard
Error

t

df

p-value

0

18

0

3.689

0.286

3.764

29.981

0.000728

1

14

0

2.611