local.mmhc.skel: Skeleton (local) around a node of the MMHC algorithm

View source: R/local.mmhc.skel.R

Skeleton (local) around a node of the max-min hill-climbing (MMHC) algorithmR Documentation

Skeleton (local) around a node of the MMHC algorithm

Description

The local skeleton of a Bayesian network around a node produced by MMHC. No orientations are involved.

Usage

local.mmhc.skel(dataset, node, max_k = 3, threshold = 0.05, test = "testIndFisher") 

Arguments

dataset

A matrix with the variables. The user must know if they are continuous or if they are categorical. If you have a matrix with categorical data, i.e. 0, 1, 2, 3 where each number indicates a category, the minimum number for each variable must be 0. data.frame is also supported, as the dataset in this case is converted into a matrix.

node

A number between 1 and the number of columns of the dataset. The local network (edges only) will be built around this node. At first the parents and children of this node are identified and then their parents and children. No inconsistencies correction whastsoever is attempted. A variable detected by the node, but the node was not detected by that variable.

max_k

The maximum conditioning set to use in the conditional indepedence test (see Details of SES or MMPC).

threshold

Threshold ( suitable values in (0, 1) ) for assessing p-values significance. Default value is 0.05.

test

The conditional independence test to use. Default value is "testIndFisher". This procedure allows for "testIndFisher", "testIndSPearman" for continuous variables and "gSquare" for categorical variables. Or in general, if the dataset is a data.frame with different types of data, leave this NULL. See also link{MMPC} for the automatic choice of tests.

Details

The MMPC is run on the user specific variable. The backward phase (see Tsamardinos et al., 2006) takes place automatically. Then, the MMPC is run on the parents and children of that variable. If the node variable is not detected by a variable, this variable is not removed though.

Value

A list including:

runtime

The run time of the algorithm. A numeric vector. The first element is the user time, the second element is the system time and the third element is the elapsed time.

ntests

The number of tests MMPC (or SES) performed at each variable.

res

A list with the parents and children of each variable. The first element is the parents and children of the node variable.

Gloc

The local adjancency matrix. A value of 1 in G[i, j] may not appear appear in G[j, i] also, indicating that variable j was discovered as a possible parent or child of node i, but not the covnerse. The usual MMHC (mmhc.skel) removes the edge between them as this is an inconsistency.

Author(s)

Michail Tsagris

R implementation and documentation: Michail Tsagris mtsagris@uoc.gr

References

Tsamardinos, Brown and Aliferis (2006). The max-min hill-climbing Bayesian network structure learning algorithm. Machine learning, 65(1), 31-78.

See Also

mmhc.skel, pc.skel, pc.or, corfs.network

Examples

# simulate a dataset with continuous data
dataset <- matrix(runif(500 * 30, 1, 100), nrow = 500 ) 
a1 <- mmhc.skel(dataset, max_k = 3, threshold = 0.05, test = "testIndFisher") 
a2 <- local.mmhc.skel(dataset, 4)
a1$runtime  
a2$runtime 

dataset <- rdag2(500, p = 20, nei = 3)$x
a1 <- mmhc.skel(dataset, max_k = 3, threshold = 0.05, test = "testIndFisher") 
a2 <- local.mmhc.skel(dataset, 5)
a1$runtime  
a2$runtime 


MXM documentation built on Aug. 25, 2022, 9:05 a.m.