t_power_curve: Create Power Curve for t-tests

View source: R/t-power-curve.R

t_power_curveR Documentation

Create Power Curve for t-tests

Description

Create a power curve from simulated data for either a given set of sample size or effect size values (variable), while holding sample or effect size (whichever is not defined in variable) constant.

S3 print method for t_power_curve objects

S3 plot method for "t_power_curve" objects.

Usage

t_power_curve(
  sequence,
  n = NULL,
  delta = NULL,
  nsim = 200L,
  reps = 25L,
  verbose = interactive(),
  ...
)

## S3 method for class 't_power_curve'
print(x, ...)

## S3 method for class 't_power_curve'
plot(x, ...)

Arguments

sequence

numeric(n). A sequence of values to vary the appropriate variable, either n or delta.

n

integer(1). The sample size.

delta

double(1). The effect size.

nsim

integer(1). Number of simulations to perform in estimating power, (1 - \beta).

reps

integer(1). Number of simulations per box to generate, i.e. number of points within each simulation box.

verbose

logical(1). Should function be run in verbose mode?

...

Additional arguments passed either to t_test_power(), only ⁠alpha =⁠, or to the S3 plotting method.

x

A t_power_curve class object, the result of a call to t_power_curve().

Value

A t_power_curve class object.

A ggplot of boxplots.

Author(s)

Stu Field

See Also

fisher_power_curve()

Examples

# constant effect size
size <- t_power_curve(seq(10, 50, 2), delta = 0.66, nsim = 25)
size

# constant sample size
delta <- t_power_curve(seq(0.5, 2.5, 0.2), n = 10, nsim = 25)
delta
plot(size)

plot(delta)

stufield/power documentation built on June 1, 2025, 7:16 p.m.