one_proportion_test: Simulation-based hypothesis test for one proportion

View source: R/s216-applets.R

one_proportion_testR Documentation

Simulation-based hypothesis test for one proportion

Description

This function will run a simulation-based hypothesis test for a single proportion of successes.

Usage

one_proportion_test(
  probability_success = 0.5,
  sample_size = 5,
  summary_measure = c("number", "proportion"),
  as_extreme_as,
  direction = c("greater", "less", "two-sided"),
  number_repetitions = 1,
  add_normal = FALSE
)

Arguments

probability_success

Value between 0 and 1 representing the null hypothesis value for proportion.

sample_size

Number of trials used to compute proportion.

summary_measure

Name of summary measure to return from simulations. Allowed values are "number" for number of successes or "proportion" for proportion of successes.

as_extreme_as

Value of observed statistic. Between 0 and 1 if summary_measure is "proportion"; an integer between 1 and sample_size if summary_measure is "number".

direction

Direction of alternative hypothesis. Allowed values are "greater", "less", or "two-sided".

number_repetitions

Number of simulated samples.

add_normal

Logical value indicating whether to superimpose a normal curve on the histogram. Defaults to FALSE.

Value

Returns plot of distribution of simulated statistics, with values as or more extreme than specified value highlighted, and reports proportion of simulations as or more extreme than specified as subtitle on plot.

Examples

one_proportion_test(
  probability_success = 0.5,
  sample_size = 150,
  summary_measure = "proportion",
  as_extreme_as = 0.65,
  direction = "greater",
  number_repetitions = 1000
)

greenwood-stat/catstats documentation built on Dec. 14, 2024, 6:25 p.m.