ci_cramersv | R Documentation |
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.
ci_cramersv(
x,
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,
...
)
x |
The result of |
probs |
Lower and upper probabilities, by default |
type |
Type of CI. One of "chi-squared" (default) or "bootstrap". |
boot_type |
Type of bootstrap CI. Only used for |
R |
The number of bootstrap resamples. Only used for |
seed |
An integer random seed. Only used for |
test_adjustment |
Adjustment to allow for test of association, see Details.
The default is |
... |
Further arguments passed to |
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.
cramersv()
, ci_chisq_ncp()
# Example from Smithson, M., page 41
test_scores <- as.table(
rbind(
Private = c(6, 14, 17, 9),
Public = c(30, 32, 17, 3)
)
)
suppressWarnings(X2 <- stats::chisq.test(test_scores))
ci_cramersv(X2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.