power_Normal {PASSED}R Documentation

Power Calculations for One and Two Sample T-tests

Description

Compute power of t test, or determine parameters to obtain target power.

Usage

power_Normal(n1 = NULL, n2 = NULL, power = NULL, sig.level = 0.05,
delta = NULL, sd1 = 1, sd2 = 1, equal.sample = TRUE,
alternative = c("two.sided", "one.sided"),
type = c("two.sample", "one.sample", "paired"),
df.method = c("welch", "classical"), strict = FALSE)

Arguments

n1

sample size in group 1, or sample size in each group if equal.sample = TRUE

n2

sample size in group 2

power

power of test (1 minus Type II error probability)

sig.level

significance level (Type I error probability)

delta

true difference in means

sd1

standard deviation for group 1

sd2

standard deviation for group 2

equal.sample

equal sample sizes for two groups, see details

alternative

one- or two-sided test

type

Type of t test

df.method

Method for calculating the degrees of default. Possibilities are welch (the default) or classical.

strict

Use strict interpretation in two-sided case

Details

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

If equal.sample = TRUE is used, N in output will denote the number in each group.

Value

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

Note

'uniroot' is used to solve power equation for unknowns, so you may see errors from it, notably about inability to bracket the root when invalid arguments are given.

Examples

# Calculate power, equal sizes
power_Normal(n1 = 150, delta = 5, sd1 = 20, sd2 = 10)
# Calculate power, unequal sizes
power_Normal(n1 = 150, delta = 5, n2 = 120, sd1 = 10)
# Calculate n1, equal sizes 
power_Normal(delta = 5,  power = 0.9, sd1 = 10, sd2 = 12)

[Package PASSED version 1.2-2 Index]