parentValues | R Documentation |
This function returns a data.frame
of dimension '1xn' containing the values of the 'n' parents of a 'node' of interest.
Use this function if you have a random sample and an observed sample with information about the parents.
The values of the parents are obtained from the evidence set unless they are not observed. In this case, the values are taken from the random sample.
parentValues(node, bn, obs, rdf)
node |
A |
bn |
A list of lists obtained from the function MoTBFs_Learning. It contains the conditional density functions of the bayesian network. |
obs |
A |
rdf |
A |
A data.frame
containing the values of the parents of 'node'.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.