power.z.test: Power calculations for two sample z tests

power.z.testR Documentation

Power calculations for two sample z tests

Description

Power calculations for two sample z tests

Usage

power.z.test(
  n = NULL,
  delta = NULL,
  sd = 1,
  sig.level = 0.05,
  power = NULL,
  type = c("two.sample", "one.sample"),
  alternative = c("two.sided", "one.sided")
)

Arguments

n

Number of observations (per group)

delta

True difference in means

sd

Standard deviation

sig.level

Significance level (Type I error probability)

power

Power of test (1 minus Type II error probability)

type

String specifying the type of t test. Can be abbreviated.

alternative

One- or two-sided test. Can be abbreviated.

Details

Exactly one of the parameters n, delta, power, sd, and sig.level must be passed as NULL, and that parameter is determined from the others. Notice that the last two have non-NULL defaults, so NULL must be explicitly passed if you want to compute them.

Value

Object of class "power.htest", a list of the arguments (including the computed one) augmented with method and note elements.

Author(s)

Felix Hofmann

Examples


# Calculate sample size
delta = 0.25
sd = 0.4
sig.level = 0.01
power = 0.95
power.z.test(delta = delta, sd = sd, sig.level = sig.level, power = power)

# Calculate the effect size
n = 92
power.z.test(power = power, sd = sd, sig.level = sig.level, n = n)

# Calculate the standard deviation
power.z.test(power = power, delta = delta, sig.level = sig.level, n = n,
             sd = NULL)

# Calculate the type I error
power.z.test(power = power, delta = delta, sig.level = NULL, n = n,
             sd = sd)


# Calculate power
power.z.test(delta = delta, sd = sd, sig.level = sig.level, n = n)


felix-hof/biostatUZH documentation built on Sept. 27, 2024, 1:48 p.m.