0-Generic-Chi-square-Test: Statistical Power for the Generic Chi-square Test

power.chisq.testR Documentation

Statistical Power for the Generic Chi-square Test

Description

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

Usage

power.chisq.test(ncp, df, alpha = 0.05, plot = TRUE,
                 plot.main = NULL, plot.sub = NULL,
                 verbose = TRUE)

Arguments

ncp

non-centrality parameter (lambda)

df

degrees of freedom. For example, for the test of homogeneity or independence df = (nrow - 1)*(ncol - 1)

alpha

probability of type I error

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 Chi-square-statistics
# greater than the critical Chi-square value
power.chisq.test(ncp = 20, df = 100, alpha = 0.05)

# power of multiple Chi-square-statistics
power.chisq.test(ncp = c(5, 10, 15, 20), plot = FALSE,
                 df = 100, alpha = 0.05)


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