conditionalmotbf.learning {MoTBFs} | R Documentation |
Learning conditional MoTBF densities
Description
Collection of functions used for learning conditional MoTBFs, computing the internal BIC, selecting the parents that get the best BIC value, and other internal functions required to learn the conditional densities.
Usage
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)
Arguments
data |
An object of class |
nameParents |
A |
nameChild |
A |
numIntervals |
A positive integer indicating the maximum number of intervals for splitting the domain of the parent variables. |
POTENTIAL_TYPE |
A |
maxParam |
A positive integer which indicates the maximum number of coefficients in the
function. If specified, the output is the function which gets the best BIC with, at most,
this number of parameters. By default, it is set to |
s |
A |
priorData |
An object of class |
domainChild |
A |
domainParents |
An object of class |
mm |
One of the inputs and the output of the recursive internal function |
conditionalfunction |
The output of the internal function |
Details
The main function, conditionalMethod()
, fits truncated basis functions for the conditioned variable
for each configuration of splits of the parent variables. The domain of the parent variables is splitted
in different intervals and univariate functions are fitted in these
ranges. The remaining above described functions are internal to the main function.
Value
The main function conditionalMethod
returns a list with the name of the parents,
the different intervals and the fitted densities
See Also
Examples
## 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)
###############################################################################
###############################################################################