Learn R Programming

pwrss (version 0.3.1)

power.chisq.test: 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)

Value

power

statistical power \((1-\beta)\)

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

Examples

Run this code
# 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)

Run the code above in your browser using DataLab