discreteStatesFromBN {MoTBFs} | R Documentation |
Get the states of all discrete nodes from a MoTFB-BN
Description
This function returns the states of all discrete nodes from a list obtained from MoTBFs_Learning.
Usage
discreteStatesFromBN(bn, dag)
Arguments
bn |
A list of lists obtained from MoTBFs_Learning. |
dag |
A network of class |
Value
discreteStatesFromBN
returns a list of length equal to the number of discrete nodes in the network. Each element of the list corresponds to a node and contains a character vector indicating the states of the node.
Examples
## Create a dataset
# Continuous variables
x <- rnorm(100)
y <- rnorm(100)
# Discrete variable
z <- sample(letters[1:2],size = 100, replace = TRUE)
data <- data.frame(C1 = x, C2 = y, D1 = z, stringsAsFactors = FALSE)
## Get DAG
dag <- LearningHC(data)
## Learn a BN
bn <- MoTBFs_Learning(dag, data, POTENTIAL_TYPE = "MTE")
## Get the states of the discrete nodes
discreteStatesFromBN(bn, dag)
[Package MoTBFs version 1.4.1 Index]