Learn R Programming

effectsize (version 0.2.0)

chisq_to_phi: Conversion between Effect sizes for Contingency Tables (Chi2, Phi, Cramer's V...)

Description

Convert between Chi square, (\(chi^2\)), phi (\(\phi\)) and Cramer's V.

Usage

chisq_to_phi(chisq, n, ...)

convert_chisq_to_phi(chisq, n, ...)

phi_to_chisq(phi, n, ...)

convert_phi_to_chisq(phi, n, ...)

chisq_to_cramers_v(chisq, n, nrow, ncol, ...)

convert_chisq_to_cramers_v(chisq, n, nrow, ncol, ...)

Arguments

chisq

The Chi2 statistic.

n

Sample size.

...

Arguments passed to or from other methods.

phi

The Phi statistic.

nrow

The number of rows in the contingency table.

ncol

The number of columns in the contingency tables.

Value

A numeric value between 0-1.

Details

These functions use the following formulae:

$$Cramer's V = \sqrt{\chi^2 / (n * (min(nrow,ncol)-1))}$$

$$\phi = \sqrt{\chi^2 / n}$$

Examples

Run this code
# NOT RUN {
contingency_table <- as.table(rbind(c(762, 327, 468), c(484, 239, 477), c(484, 239, 477)))

chisq.test(contingency_table)
#
#         Pearson's Chi-squared test
#
# data:  ctab
# X-squared = 41.234, df = 4, p-value = 2.405e-08

chisq_to_phi(41.234, n = sum(contingency_table))
chisq_to_cramers_v(41.234,
  n = sum(contingency_table),
  nrow = nrow(contingency_table),
  ncol = ncol(contingency_table)
)
# }

Run the code above in your browser using DataLab