This function calculates CIs for the non-centrality parameter (NCP) of the \(\chi^2\)-distribution. A positive lower \((1 - \alpha) \cdot 100\%\)-confidence limit for the NCP goes hand-in-hand with a significant association test at level \(\alpha\).
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).
Should Yates continuity correction be applied to the 2x2 case? The
default is TRUE (also used in the bootstrap), which differs from ci_cramersv().
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".
Further arguments passed to boot::boot().
An object of class "cint", see ci_mean() for details.
By default, CIs are computed by Chi-squared test inversion. This can be unreliable for very large test statistics. The default bootstrap type is "bca".
Smithson, M. (2003). Confidence intervals. Series: Quantitative Applications in the Social Sciences. New York, NY: Sage Publications.
ci_chisq_ncp(mtcars[c("am", "vs")])
#>
#> Two-sided 95% chi-squared confidence interval for the non-centrality
#> parameter of the chi-squared distribution
#>
#> Sample estimate: 0
#> Confidence interval:
#> 2.5% 97.5%
#> 0.000000 6.423431
#>
ci_chisq_ncp(mtcars[c("am", "vs")], type = "bootstrap", R = 999) # Use larger R
#>
#> Two-sided 95% bootstrap confidence interval for the non-centrality
#> parameter of the chi-squared distribution based on 999 bootstrap
#> replications and the bca method
#>
#> Sample estimate: 0
#> Confidence interval:
#> 2.5% 97.5%
#> 0.000000 4.722751
#>