Learn R Programming

ddgraph (version 1.16.0)

ciTest,DDDataSet-method: Do conditional independence test on DDDataSet...

Description

Do conditional independence test on DDDataSet

Usage

"ciTest"(obj, var1, var2, cond, test.type="mc-x2-c", B, min.table.size, ...)

Arguments

obj
DDDataSet object on which (conditional) independence test needs to be done
var1
the name or index of the first variable to be tested
var2
the name or index of the second variable
cond
the names or indexes of variables to condition on (defaults to NULL)
test.type
the type of statistical test (defaults to mc-x2)
B
the number of replicates for MC-based tests (default to NULL)
min.table.size
the minimal number of samples in a contingency table per conditioning set (makes sense only for discrete data)
...
unused

Value

Details

This function does a conditional independence var1 indep var2 | cond. The following test types are available (implemented by package bnlearn).

For binary data:

  • "fisher" - Fisher's exact test (only for unconditional independence)
  • "mi" - Mutual Information (discrete)
  • "mi-sh" - Mutual Information (discrete, shrinkage)
  • "mc-mi" - Mutual Information (discrete, Monte Carlo)
  • "aict" - AIC-like Test
  • "x2" - Pearson's X^2
  • "mc-x2" - Pearson's X^2 (Monte Carlo)
  • "mc-x2-c" - Pearson's X^2 (Monte Carlo) the corrected version
  • "g2" - G^2 test (requires pcalg package)

For continuous data:

  • "mi-g" - Mutual Information (Gaussian)
  • "mi-g-sh" - Mutual Information (Gaussian, shrinkage)
  • "mc-mi-g" - Mutual Information (Gaussian, Monte Carlo)
  • "cor" - Pearson's Linear Correlation
  • "mc-cor" - Pearson's Linear Correlation (Monte Carlo)
  • "zf" - Fisher's Z Test
  • "mc-zf" - Fisher's Z Test (Monte Carlo)

Examples

Run this code
# test if tin_4.6 is independent of class labels
ciTest(mesoBin$Meso, "Tin 4-6h", "class")
# test if tin_4.6 is independent of class conditioned on twi_2.4
ciTest(mesoBin$Meso, "Tin 4-6h", "class", "Twi 2-4h")
# repeat the test using G2 asymptotic distribution
ciTest(mesoBin$Meso, "Tin 4-6h", "class", "Twi 2-4h", test.type="g2")

Run the code above in your browser using DataLab