Learn R Programming

effectsize (version 0.6.0.1)

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

Description

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

Usage

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

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

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

chisq_to_pearsons_c( chisq, n, nrow, ncol, ci = 0.95, alternative = "greater", ... )

phi_to_chisq(phi, n, ...)

Arguments

chisq

The Chi-squared statistic.

n

Total 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

alternative

a character string specifying the alternative hypothesis; Controls the type of CI returned: "greater" (default) or "less" (one-sided CI), or "two.sided" (default, two-sided CI). Partial matching is allowed (e.g., "g", "l", "two"...). See One-Sided CIs in effectsize_CIs.

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), and confidence interval(s). See cramers_v().

Confidence (Compatibility) Intervals (CIs)

Unless stated otherwise, confidence (compatibility) intervals (CIs) are estimated using the noncentrality parameter method (also called the "pivot method"). This method finds the noncentrality parameter ("ncp") of a noncentral t, F, or \(\chi^2\) distribution that places the observed t, F, or \(\chi^2\) test statistic at the desired probability point of the distribution. For example, if the observed t statistic is 2.0, with 50 degrees of freedom, for which cumulative noncentral t distribution is t = 2.0 the .025 quantile (answer: the noncentral t distribution with ncp = .04)? After estimating these confidence bounds on the ncp, they are converted into the effect size metric to obtain a confidence interval for the effect size (Steiger, 2004).

For additional details on estimation and troubleshooting, see effectsize_CIs.

CIs and Significance Tests

"Confidence intervals on measures of effect size convey all the information in a hypothesis test, and more." (Steiger, 2004). Confidence (compatibility) intervals and p values are complementary summaries of parameter uncertainty given the observed data. A dichotomous hypothesis test could be performed with either a CI or a p value. The 100 (1 - \(\alpha\))% confidence interval contains all of the parameter values for which p > \(\alpha\) for the current data and model. For example, a 95% confidence interval contains all of the values for which p > .05.

Note that a confidence interval including 0 does not indicate that the null (no effect) is true. Rather, it suggests that the observed data together with the model and its assumptions combined do not provided clear evidence against a parameter value of 0 (same as with any other value in the interval), with the level of this evidence defined by the chosen \(\alpha\) level (Rafi & Greenland, 2020; Schweder & Hjort, 2016; Xie & Singh, 2013). To infer no effect, additional judgments about what parameter values are "close enough" to 0 to be negligible are needed ("equivalence testing"; Bauer & Kiesser, 1996).

Details

These functions use the following formulae:

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

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

$$Pearson's C = \sqrt{\chi^2 / (\chi^2 + n)}$$

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:  contingency_table
#> 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)
)
chisq_to_pearsons_c(41.234,
  n = sum(contingency_table),
  nrow = nrow(contingency_table),
  ncol = ncol(contingency_table)
)
# }

Run the code above in your browser using DataLab