Learn R Programming

effectsize (version 0.4.4)

chisq_to_phi: Conversion Chi-Squared to Phi or Cramer's V

Description

Convert between Chi square, (\(\chi^2\)), Cramer's V, phi (\(\phi\)) and Cohen's w for contingency tables or goodness of fit.

Usage

chisq_to_phi(chisq, n, nrow, ncol, ci = 0.95, adjust = FALSE, ...)

chisq_to_cohens_w(chisq, n, nrow, ncol, ci = 0.95, adjust = FALSE, ...)

chisq_to_cramers_v(chisq, n, nrow, ncol, ci = 0.95, adjust = FALSE, ...)

phi_to_chisq(phi, n, ...)

Arguments

chisq

The Chi-squared statistic.

n

Sample size.

nrow, ncol

The number of rows/columns in the contingency table (ignored for Phi when adjust=FALSE and CI=NULL).

ci

Confidence Interval (CI) level

adjust

Should the effect size be bias-corrected? Defaults to FALSE.

...

Arguments passed to or from other methods.

phi

The Phi statistic.

Value

A data frame with the effect size(s) between 0-1, and confidence interval(s). See cramers_v().

Confidence Intervals

Unless stated otherwise, confidence intervals are estimated using the Noncentrality parameter method; These methods searches for a the best non-central parameters (ncps) of the noncentral t-, F- or Chi-squared distribution for the desired tail-probabilities, and then convert these ncps to the corresponding effect sizes. (See full effectsize-CIs for more.)

CI Contains Zero

For positive only effect sizes (Eta squared, Cramer's V, etc.; Effect sizes associated with Chi-squared and F distributions), special care should be taken when interpreting CIs with a lower bound equal to 0, and even more care should be taken when the upper bound is equal to 0 (Steiger, 2004; Morey et al., 2016). For example:

eta_squared(aov(mpg ~ factor(gear) + factor(cyl), mtcars[1:7, ]))

## Parameter    | Eta2 (partial) |       90% CI
## --------------------------------------------
## factor(gear) |           0.58 | [0.00, 0.84]
## factor(cyl)  |           0.46 | [0.00, 0.78]

Details

These functions use the following formulae:

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

$$Cramer's V = \phi / \sqrt{min(nrow,ncol)-1}$$

For adjusted versions, see Bergsma, 2013.

References

  • Cumming, G., & Finch, S. (2001). A primer on the understanding, use, and calculation of confidence intervals that are based on central and noncentral distributions. Educational and Psychological Measurement, 61(4), 532-574.

  • Bergsma, W. (2013). A bias-correction for Cramer's V and Tschuprow's T. Journal of the Korean Statistical Society, 42(3), 323-328.

See Also

Other effect size from test statistic: F_to_eta2(), t_to_d()

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),
  nrow = nrow(contingency_table),
  ncol = ncol(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