
Last chance! 50% off unlimited learning
Sale ends in
calcDependence(dd, method="ncpc", ...)
ncpc()
, plotBNLearn()
and plotPCAlgo()
depending on the picked algorithm (parameter method
).Extra parameters for ncpc and ncpc*:
ciTest
for available conditional independence tests
package-bnlearn
.
Extra parameters for hc-bic, hc-bde, mmhc-bic, mmhc-bde:
Extra parameters for iamb, fast.iamb, inter.iamb, mmpc:
Extra parameters for pc:
mcX2Test
(a wrapper around mc-x2-c (Monte Carlo X2 test)
with B=5000), mcX2TestB50k
(a wrapper around mc-x2-c (Monte Carlo X2 test) test with B=50000),
mcMITest
(wrapper around mc-mi test from bnlearn
with B=5000).
The package pcalg
additionally provide following tests:
binCItest
for binary data (performs a G^2 test) and gaussCItest
for continuous data
(performs Fisher's Z transformation), dicCItest
for discrete data (performs G^2 test).
DDGraph
for ncpc and ncpc* algorithms, or
of class bn
for bnlearn
algorithms, or
of class pcAlgo
for PC algorithm.
Consider a set of variable X_1, ..., X_m and a target variable T. We say that that X_i is directly dependent with T if there is no other set of variable X_j, X_k, ... such that it renders X_i conditionally independent of T. In other words, X_i is the most immediate casual cause/consequence of T in the set of chosen variables.
Note that the above statement is different from that of classical feature selection for classification. A set of features obtained with feature selection have the property that a good classifier can be made based on them alone, while the above statement establishes statistical properties of variables. The set of variables with direct dependence might not be optimal for classification, since classification performance can be strongly influenced by false negatives (Friedman et al, 1997).
data(mesoBin)
# increase alpha to 0.1, suppress progress output
calcDependence(mesoBin$VM, "ncpc", alpha=0.05)
# run ncpc* with mutual information with shrinkage and minimal numbers of
# samples per conditioning set of 15
calcDependence(mesoBin$VM, "ncpc*", test.type="mi-sh", min.table.size=15)
# run PC algorithm using the G^2 test from pcalg package
calcDependence(mesoBin$VM, "pc", indepTest=pcalg::binCItest)
# run hill-climbing with BIC penalization and plot the resulting Bayesian Network
# NOTE: plotting requires the Rgraphviz package
if(require("Rgraphviz"))
calcDependence(mesoBin$VM, "hc-bic", make.plot=TRUE)
# continuous data example
data(mesoCont)
# run ncpc with linear correlation test and with maximal conditioning set of 3
res <- calcDependence(mesoCont$VM, "ncpc", max.set.size=3, test.type="cor")
# plot the resulting ddgraph with colours
if(require("Rgraphviz"))
plot(res$obj, col=TRUE)
Run the code above in your browser using DataLab