pwr_chisq_test_association: Power and sample size for chi squared test.

Description Usage Arguments Details Value Examples

View source: R/pwr_chisq_test_association.R

Description

pwr_chisq_test_association computes the power and the sample size for the chi squared testing to check association between two qualitative variables.

Usage

1
2
pwr_chisq_test_association(es, nrow, ncol, n = NULL, pwr = NULL,
sig_level = 0.05)

Arguments

es

effect size w = √{\frac{χ^2_{obs}}{n}}

nrow

number of categories of the first variable

ncol

number of categories of the second variable

n

number of observations (sample size)

pwr

power of test 1 + β (1 minus type II error probability)

sig_level

significance level (Type I error probability)

Details

In this function, we use the effect size es =√{\frac{χ_{obs}^2}{n}}, where n is the sample size and χ^2_{obs} is the statistics test. es is a coefficient or measure of association.

The effect size es =w=√{\frac{w^2}{n}} is an strength measure of association. Usually, we use

w=0.1

to detect a weak association between two variables

w=0.3

to detect a moderate association between two variables

w=0.5

to detect a strong association between two variables

Value

pwr_chisq_test_association returns a list with the following components:

es

effect size

nrow

number of categories of the first variable

ncol

number of categories of the second variable

sig_level

significance level

power_sampleSize

A tibble with sample size and n is the number of pairs

Examples

1
2
3
4
5
6
# Power
pwr_chisq_test_association(es = 0.5, nrow = 5, ncol = 5,
n = 300, pwr = NULL, sig_level = 0.05)
# Sample size
pwr_chisq_test_association(es = 0.5, nrow = 5, ncol = 5,
n = NULL, pwr = 0.99, sig_level = 0.05)

gilberto-sassi/power documentation built on July 17, 2020, 1:02 p.m.