Package: CCI 0.4.0

Christian Thorjussen

CCI: Computational Test for Conditional Independence

Tool for performing computational testing for conditional independence between variables in a dataset. 'CCI' implements permutation in combination with Monte Carlo Cross-Validation in generating null distributions and test statistics. For more details see Computational Test for Conditional Independence (2024) <doi:10.3390/a17080323>.

Authors:Christian Thorjussen [aut, cre], Kristian Hovde Liland [aut]

CCI_0.4.0.tar.gz
CCI_0.4.0.zip(r-4.7-any)CCI_0.4.0.zip(r-4.6-any)CCI_0.4.0.zip(r-4.5-any)
CCI_0.4.0.tgz(r-4.6-any)CCI_0.4.0.tgz(r-4.5-any)
CCI_0.4.0.tar.gz(r-4.7-any)CCI_0.4.0.tar.gz(r-4.6-any)
CCI_0.4.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
CCI/json (API)

# Install 'CCI' in R:
install.packages('CCI', repos = c('https://khliland.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/khliland/cci/issues

Datasets:

On CRAN:

Conda:

5.64 score 2 stars 12 scripts 463 downloads 23 exports 83 dependencies

Last updated from:2c71af0ecb. Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-develOK326
source / vignettesOK799
linux-releaseOK232
macos-releaseOK154
macos-oldrelOK152
windows-develOK157
windows-releaseOK136
windows-oldrelOK167
wasm-releaseOK140

Exports:add_interaction_termsadd_poly_termsbuild_formulaCCI.crtCCI.directionCCI.pretunerCCI.testcheck_formulaclean_formulaget_pvaluesget_tuned_paramsis_categorical_Z_anymake_strata_from_categorical_Zperm.testpermute_within_strataQQplotreduce_Z_pcatest.genunclean_formulawrapper_knnwrapper_rangerwrapper_svmwrapper_xgboost

Dependencies:caretclasscliclockcodetoolscpp11crayondata.tablediagramdigestdplyre1071farverforeachfuturefuture.applygenericsggplot2globalsgluegowergtablehardhathmsigraphipredisobanditeratorsjsonliteKernSmoothkknnlabelinglatticelavalifecyclelistenvlubridatemagrittrMASSMatrixModelMetricsnlmennetnumDerivparallellypillarpkgconfigplyrprettyunitspROCprodlimprogressprogressrproxypurrrR6rangerRColorBrewerRcppRcppEigenrecipesreshape2rlangrpartS7scalesshapesparsevctrsSQUAREMstringistringrsurvivaltibbletidyrtidyselecttimechangetimeDatetzdbutf8vctrsviridisLitewithrxgboost

Applied examples: causal models and time series
Testing a causal model (DAG) | Time series | References

Last update: 2026-09-23
Started: 2026-09-23

Custom models and performance metrics
Custom performance metrics with metricfunc | Regression: $R^2$ | Classification: balanced accuracy and Brier score | Custom learners with mlfunc | A linear model | Logistic regression with extra arguments | Any model from caret | Tips

Last update: 2026-09-23
Started: 2026-09-23

Diagnostics, tuning and test direction
Look at the null distribution | Number of Monte Carlo samples and parametric p-values | QQ-plot of p-values | Very high p-values | Failed model fits | Tuning the learner | Choosing the direction of the test | A checklist | References

Last update: 2026-09-23
Started: 2026-09-23

Getting started with CCI
The idea behind the test | A first test | The formula | Choosing the learner | Different types of data | Large data sets | References

Last update: 2026-09-23
Started: 2026-01-16

Readme and manuals

Help Manual

Help pageTopics
Creates interaction terms for specified variables in a data frame Interaction terms are named as '<var1>_int_<var2>' (e.g., 'Z1_int_Z2' for the product of 'Z1' and 'Z2').add_interaction_terms
Creates polynomial terms for specified variables in a data frame Polynomial terms are named as '<variable>_d_<degree>' (e.g., 'Z1_d_2' for the square of 'Z1').add_poly_terms
Build an expanded formula with poly and interaction termsbuild_formula
Conditional randomization version of the CCI test (CRT-CCI, experimental)CCI.crt
Choose Direction for testing for the CCI testCCI.direction
CCI tuner function for CCI testCCI.pretuner tuner
Computational test for conditional independence based on ML and Monte Carlo Cross ValidationCCI CCI.test
Check the formula statementcheck_formula
Clean and Reformat Formula Stringclean_formula
Example dataset: ExponentialNoiseExponentialNoise
P-value Calculation Based on Null Distribution and Test Statisticget_pvalues
Get the best parameters after tuning with CCI.tunerget_tuned_params
Example dataset: HardCaseHardCase
Check whether Z contains at least one categorical variableis_categorical_Z_any
Create strata from the categorical subset of Zmake_strata_from_categorical_Z
Example dataset: NonLinearCategorizationNonLinearCategorization
Example dataset: NonLinNormalNonLinNormal
Example dataset: NonLinNormalZs_d0NonLinNormalZs_d0
Example dataset: NonLinNormalZs_d05NonLinNormalZs_d05
Example dataset: NormalDataNormalData
Permutation Test for Conditional Independenceperm.test
Stratified permutation of x within stratapermute_within_strata
Plot for CCI testingplot.CCI
Example dataset: PoissonNoisePoissonNoise
Example dataset: PolyDataPolyData
Print and summary methods for the CCI classprint.CCI print.summary.CCI reports summary.CCI
QQ-plot for multiple testing in CCIQQplot
Reduce the conditioning variables Z with principal component analysisreduce_Z_pca
Generate the Test Statistic or Null Distribution Using Permutationtest.gen
Convert CI-style formula Y ~ X | Z into regression-style Y ~ X + Zunclean_formula
Example dataset: UniformNoise_largeUniformNoise_large
k-Nearest Neighbors (KNN) wrapper for CCI (kknn-based)wrapper_knn
Random Forest wrapper for CCIwrapper_ranger
SVM wrapper for CCIwrapper_svm
Extreme Gradient Boosting wrapper for CCIwrapper_xgboost