conditionalmotbf.learning {MoTBFs} | R Documentation |
Collection of functions for learning conditional MoTBFs, computing the internal BIC, selecting the parents that get the best BIC value, and other internal functions needed to get the final conditionals.
conditionalMethod(
data,
nameParents,
nameChild,
numIntervals,
POTENTIAL_TYPE,
maxParam = NULL,
s = NULL,
priorData = NULL
)
conditional(
data,
nameParents,
nameChild,
domainChild,
domainParents,
numIntervals,
mm,
POTENTIAL_TYPE,
maxParam = NULL,
s = NULL,
priorData = NULL
)
select(
data,
nameParents,
nameChild,
domainChild,
domainParents,
numIntervals,
POTENTIAL_TYPE,
maxParam = NULL,
s = NULL,
priorData = NULL
)
learn.tree.Intervals(
data,
nameParents,
nameChild,
domainParents,
domainChild,
numIntervals,
POTENTIAL_TYPE,
maxParam = NULL,
s = NULL,
priorData = NULL
)
BICscoreMoTBF(conditionalfunction, data, nameParents, nameChild)
data |
A dataset of class |
nameParents |
A |
nameChild |
The name of the child variable as a |
numIntervals |
A |
POTENTIAL_TYPE |
A |
maxParam |
A |
s |
A |
priorData |
Prior dataset with values of the variables we have information apriori about.
This dataset must be of |
domainChild |
An |
domainParents |
A matrix of class |
mm |
One of the inputs and the output of the recursive function |
conditionalfunction |
The output of the function |
The main function conditionalMethod
fits truncated functions for a variable which depends
on others variables. The domain of the parent variables is splitted
in different intervals and univariate functions are fitted in these
ranges. The rest of the described functions are internal ones of the main function.
The main function conditionalMethod
returns a list with the name of the parents,
the different intervals and the fitted functions.
## Dataset
X <- rnorm(1000)
Y <- rbeta(1000, shape1 = abs(X)/2, shape2 = abs(X)/2)
Z <- rnorm(1000, mean = Y)
data <- data.frame(X = X, Y = Y, Z = Z)
## Conditional Method
parents <- c("X","Y")
child <- "Z"
intervals <- 2
potential <- "MTE"
fMTE <- conditionalMethod(data, nameParents = parents, nameChild = child,
numIntervals = intervals, POTENTIAL_TYPE = potential)
printConditional(fMTE)
##############################################################################
potential <- "MOP"
fMOP <- conditionalMethod(data, nameParents = parents, nameChild = child,
numIntervals = intervals, POTENTIAL_TYPE = potential, maxParam = 15)
printConditional(fMOP)
##############################################################################
##############################################################################
## Internal functions: Not needed to run #####################################
##############################################################################
domainP <- range(data[,parents])
domainC <- range(data[, child])
t <- conditional(data, nameParents = parents, nameChild = child,
domainParents = domainP, domainChild = domainC, numIntervals = intervals,
mm = NULL, POTENTIAL_TYPE = potential)
printConditional(t)
selection <- select(data, nameParents = parents, nameChild = child,
domainParents = domainP, domainChild = domainC, numIntervals = intervals,
POTENTIAL_TYPE = potential)
parent1 <- selection$parent; parent1
domainParent1 <- range(data[,parent1])
treeParent1 <- learn.tree.Intervals(data, nameParents = parent1,
nameChild = child, domainParents = domainParent1, domainChild = domainC,
numIntervals = intervals, POTENTIAL_TYPE = potential)
BICscoreMoTBF(treeParent1, data, nameParents = parent1, nameChild = child)
###############################################################################
###############################################################################