0-Generic-t-Test: Statistical Power for the Generic t Test

power.t.testR Documentation

Statistical Power for the Generic t Test

Description

Calculates statistical power for the generic t test with (optional) Type I and Type II error plots. Unlike other more specific functions power.t.test() function allows multiple values for one parameter at a time (only when plot = FALSE).

Usage

power.t.test(ncp, df, alpha = 0.05,
             alternative = c("not equal", "greater", "less",
                             "non-inferior", "superior", "equivalent"),
             plot = TRUE, plot.main = NULL, plot.sub = NULL,
             verbose = TRUE)

Arguments

ncp

non-centrality parameter (lambda)

df

degrees of freedom

alpha

probability of type I error

alternative

direction or type of the hypothesis test: "not equal", "greater", "less", "equivalent", "non-inferior", or "superior". The same non-centrality parameters will produce the same power rates for "greater", "less", "non-inferior", and "superior" tests. Different labels have been used merely for consistency. However, it should be noted that the non-centrality parameter should conform to the specific test type

plot

if TRUE plots Type I and Type II error

plot.main

plot title

plot.sub

plot subtitle

verbose

if FALSE no output is printed on the console. Useful for simulation, plotting, and whatnot

Value

power

statistical power (1-\beta)

Examples

# power is defined as the probability of observing t-statistics
# greater than the positive critical t value OR
# less than the negative critical t value
power.t.test(ncp = 1.96, df = 99, alpha = 0.05,
             alternative = "not equal")

# power is defined as the probability of observing t-statistics
# greater than the critical t value
power.t.test(ncp = 1.96, df = 99, alpha = 0.05,
             alternative = "greater")

# power is defined as the probability of observing t-statistics
# greater than the critical t value where the non-centrality parameter
# for the alternative distribution is adjusted for the non-inferiority margin
power.t.test(ncp = 1.98, df = 99, alpha = 0.05,
             alternative = "non-inferior")

# power is defined as the probability of observing t-statistics
# greater than the critical t value where the non-centrality parameter
# for the alternative distribution is adjusted for the superiority margin
power.t.test(ncp = 1.94, df = 99, alpha = 0.05,
             alternative = "superior")

# power is defined as the probability of observing t-statistics
# less than the positive critical t value AND
# greater than the negative critical t value
# the non-centrality parameter is for the null distribution
# and is derived from the equivalence margins (lower and upper)
power.t.test(ncp = 1.96, df = 999, alpha = 0.05,
             alternative = "equivalent")
# or, define lower and upper bound with rbind()
power.t.test(ncp = rbind(-1.96, 1.96),
             df = 999, alpha = 0.05,
             alternative = "equivalent")

pwrss documentation built on April 12, 2023, 12:34 p.m.