r.data.frame {MoTBFs} | R Documentation |
Data frame initialization for forward sampling
Description
The function r.data.frame()
initializes a data frame with as many columns as nodes in the MoTBF-network. It also asings each column its data type, i.e., numeric or character. In the case of character columns, the states of the variable are extracted from the "bn"
argument and included as levels.
Usage
r.data.frame(bn, dag)
Arguments
bn |
A list of lists obtained from the function MoTBFs_Learning. |
dag |
An object of class |
Value
An object of class "data.frame"
, which contains the data type of each column and has no rows.
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")
## Initialize a data.frame containing 3 columns (x, y and z) with their attributes.
r.data.frame(bn, dag)
[Package MoTBFs version 1.4.1 Index]