ztest.1samp: Power calculation for one-sample z test

ztest.1sampR Documentation

Power calculation for one-sample z test

Description

This function performs power and sample size calculations for a one-sample z test which is analogous to a one-sample t test with the variance assumed to be known. This function is provided largely for pedagogical purposes; in general, for real studies, the one-sample t test procedure should be used.

Usage

ztest.1samp(
  N = NULL,
  delta = NULL,
  sd = 1,
  alpha = 0.05,
  power = NULL,
  sides = 2,
  v = FALSE
)

Arguments

N

The sample size.

delta

muA (the true mean) - mu0 (the mean under the null).

sd

The standard deviation; defaults to 1.

alpha

The significance level (type 1 error rate); defaults to 0.05.

power

The specified level of power.

sides

Either 1 or 2 (default) to specify a one- or two- sided hypothesis test.

v

Either TRUE for verbose output or FALSE (default) to output computed argument only.

Value

A list of the arguments (including the computed one).

Examples

ztest.1samp(N = NULL, delta = 6.5 - 5.7, sd = 2, power = 0.8, sides = 2)
ztest.1samp(N = 40, delta = NULL, sd = 1, power = 0.9, sides = 2)
ztest.1samp(N = NULL, delta = 0.6, sd = 1, power = 0.8, sides = 1)

powertools documentation built on April 4, 2025, 5:02 a.m.