Learn R Programming

rashnu (version 0.1.2)

one_norm_size: Sample Size or Power Calculation for One-Sample Normal Mean Test

Description

Calculates sample size or power for a two-sample normal mean test.

Usage

one_norm_size(mu, mu0, sd, alpha, beta = NULL, n = NULL)

Value

Numeric. Returns sample size (if beta is given), or power (if n is given).

Arguments

mu

Numeric. True mean.

mu0

Numeric. Null hypothesis mean.

sd

Numeric. Standard deviation.

alpha

Numeric. Type I error rate.

beta

Numeric (optional). Type II error rate. Required for sample size calculation.

n

Integer (optional). Sample size. Required for power calculation.

Examples

Run this code
# Sample size
one_norm_size(mu = 2, mu0 = 1.5, sd = 1,
              alpha = 0.05, beta = 0.2)

# Power
one_norm_size(mu = 2, mu0 = 1.5, sd = 1,
              alpha = 0.05, n = 32)

Run the code above in your browser using DataLab