# NOT RUN {
## Dataset
data("ecoli", package = "MoTBFs")
data <- ecoli[,-c(1,9)]
## Get directed acyclic graph
dag <- LearningHC(data)
## Learn bayesian network
bn <- MoTBFs_Learning(dag, data = data, numIntervals = 4, POTENTIAL_TYPE = "MTE")
## Specify the evidence set
obs <- data.frame(lip = "1", alm1 = 0.5, stringsAsFactors=FALSE)
## Create a random sample
contData <- data[ ,which(lapply(data, is.numeric) == TRUE)]
fx <- lapply(contData, univMoTBF, POTENTIAL_TYPE = "MTE")
disData <- data[ ,which(lapply(data, is.numeric) == FALSE)]
conSample <- lapply(fx, rMoTBF, size = 1)
disSample <- lapply(unique(disData), sample, size = 1)
rdf <- as.data.frame(list(conSample,disSample), stringsAsFactors = FALSE)
## Get the values of the parents of node "alm2"
parentValues("alm2", bn, obs, rdf)
# }
Run the code above in your browser using DataLab