tpower: Power for t tests, including arbitrary linear hypotheses

View source: R/tpower.r

tpowerR Documentation

Power for t tests, including arbitrary linear hypotheses

Description

Power for t tests, including arbitrary linear hypotheses

Usage

tpower(
  n,
  delta,
  lam = c(1, -1),
  b,
  sd = 1,
  alpha = 0.05,
  w = rep(1, g),
  n1,
  n2,
  verbose = (N == 1)
)

tsamsize(delta, b = c(delta, 0), w = rep(1, g), power = 0.8, upper = 5000, ...)

Arguments

n

Sample size (total).

delta

Effect size; if specified, a two-group design is assumed. If more than two groups, use b instead.

lam

Contrast.

b

If a vector, the coefficient for each group. If a matrix, must have length(n) rows.

sd

Standard deviation of outcome.

alpha

Type I error rate.

w

Weights for unequal allocation (normalized to 1).

n1, n2

Sample size for group 1, 2.

verbose

Print details for power calculations. Default: TRUE unless vectorized.

power

Desired power.

upper

Upper bound for tsamsize(); increase if tsamsize hits this bound. Default: 5000.

...

For tsamsize(), additional arguments to be passed to tpower().

Examples

tpower(100, 0.5)
tpower(10*(6:9), 0.5)                # Vectorize sample size
tpower(100, seq(0.25, 1, by=0.25))   # Vectorize effect size
tpower(100, 0.5, alpha=seq(0.01, 0.05, 0.01))   # Vectorize alpha
tpower(99, b=c(0.5, 0.5, 0), lam=c(1,1,-1))    # A multi-group example
tsamsize(0.5)
tsamsize(lam=c(-1,1,0,0), b=c(0,1,1,1))

pbreheny/breheny documentation built on March 30, 2024, 7:37 p.m.