ci_cramersv: CI for the Population Cramer's V

View source: R/ci_cramersv.R

ci_cramersvR Documentation

CI for the Population Cramer's V


This function calculates CIs for the population Cramer's V. By default, a parametric approach based on the non-centrality parameter (NCP) of the chi-squared distribution is utilized. Alternatively, bootstrap CIs are available (default "bca"), also by boostrapping CIs for the NCP and then mapping the result back to Cramer's V.


  probs = c(0.025, 0.975),
  type = c("chi-squared", "bootstrap"),
  boot_type = c("bca", "perc", "norm", "basic"),
  R = 9999L,
  seed = NULL,
  test_adjustment = TRUE,



The result of stats::chisq.test(), a matrix/table of counts, or a data.frame with exactly two columns representing the two variables.


Lower and upper probabilities, by default c(0.025, 0.975).


Type of CI. One of "chi-squared" (default) or "bootstrap".


Type of bootstrap CI. Only used for type = "bootstrap".


The number of bootstrap resamples. Only used for type = "bootstrap".


An integer random seed. Only used for type = "bootstrap".


Adjustment to allow for test of association, see Details. The default is TRUE.


Further arguments passed to boot::boot().


A positive lower (1 - \alpha) \cdot 100\%-confidence limit for the NCP goes hand-in-hand with a significant association test at level \alpha. In order to allow such test approach also with Cramer's V, if the lower bound for the NCP is 0, we round down to 0 the lower bound for Cramer's V as well. Without this slightly conservative adjustment, the lower limit for V would always be positive since the CI for V is found by \sqrt{(\textrm{CI for NCP} + \textrm{df})/(n \cdot (k - 1))}, where k is the smaller number of levels in the two variables (see Smithson, p.40). Use test_adjustment = FALSE to switch off this behaviour. Note that this is also a reason to bootstrap V via NCP instead of directly bootstrapping V.

Further note that no continuity correction is applied for 2x2 tables, and that large chi-squared test statistics might provide unreliable results with method "chi-squared", see stats::pchisq().


An object of class "cint", see ci_mean() for details.


Smithson, M. (2003). Confidence intervals. Series: Quantitative Applications in the Social Sciences. New York, NY: Sage Publications.

See Also

cramersv(), ci_chisq_ncp()


# Example from Smithson, M., page 41
test_scores <- as.table(
    Private = c(6, 14, 17, 9),
    Public = c(30, 32, 17, 3)
suppressWarnings(X2 <- stats::chisq.test(test_scores))

confintr documentation built on June 7, 2023, 6:24 p.m.