Skip to contents

Create a summary table for a one-sample proportion test

Usage

infer_1prop_test(
  data,
  formula,
  success = NULL,
  p0 = 0.5,
  digits = 3,
  conf_lvl = 0.95,
  caption = NULL
)

Arguments

data

A data frame (or tibble).

formula

The variable to run the test on, in formula syntax, ~var.

success

The data value that constitutes a "success".

p0

The null hypothesis value. Defaults to 0.5.

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.

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. P-values are one-sided.

Examples

infer_1prop_test(mtcars, ~vs, success = 1)
One-Sample Proportion Test on Variable vs
Successes: 1
Null Value: 0.5

n
Successes

n
Missing

n
Used

Standard
Error

z

p-value
(2 tail)

14

0

32

0.438

0.0884

-0.707

0.48

infer_1prop_test(mtcars, ~vs, success = 1, conf_lvl = 0.90)
One-Sample Proportion Test on Variable vs
Successes: 1
Null Value: 0.5

n
Successes

n
Missing

n
Used

Standard
Error

z

p-value
(2 tail)

14

0

32

0.438

0.0884

-0.707

0.48

infer_1prop_test(mtcars, ~vs, success = 1, p0 = 0.4)
One-Sample Proportion Test on Variable vs
Successes: 1
Null Value: 0.4

n
Successes

n
Missing

n
Used

Standard
Error

z

p-value
(2 tail)

14

0

32

0.438

0.0866

0.433

0.665