Learn R Programming

MoTBFs (version 2.0)

jointmotbf.fit: Joint MoTBF density learning

Description

Function for learning joint MoTBFs. The jointmotbf.fit() function is a wrapper of two internal (non-exported) functions: getParamJoint() and fixParamJoint(). The first one gets the parameters by solving a quadratic optimization problem, minimizing the mean squared error between the empirical joint CDF and the estimated CDF. The density is obtained as the derivative of the estimated CDF. The second one, fixParamJoint(), fixes the equation of the joint function using the previously learned parameters and converting this "character" string into an object of class "jointmotbf".

Usage

jointmotbf.fit(
  X,
  ranges = NULL,
  dimensions = NULL,
  fitPoints = 10,
  constraints = 10
)

Value

jointmotbf.fit() returns a list with the following elements:

Function

The analytical expression of the learned density.

Domain

A "matrix" containing the domain of each variable over which the density is defined.

Iterations

The number of iterations needed to solve the problem.

Time

The execution time.

Arguments

X

a dataset of class "data.frame".

ranges

a "numeric" matrix containing the range of the variables used to fit the function, where each column corresponds to a variable. If not specified, the range of each variable is computed from the data.

dimensions

a "numeric" vector containing the number of parameters of each variable.

fitPoints

an "integer" indicating the number of points per variable to use to build the expanded grid where the objective function will be evaluated when optimizing the parameters.

constraints

an "integer" indicating the number of constraints under which to minimize the quadratic function.

Examples

Run this code
## 1. EXAMPLE 
## Generate a multinormal dataset
data <- data.frame(X1 = rnorm(100), X2 = rnorm(100))

## Joint learnings
dim <- c(2,3)
P <- jointmotbf.fit(data, dimensions = dim)

P
attributes(P)
class(P)

###############################################################################
## MORE EXAMPLES ##############################################################
###############################################################################
# \donttest{
## Generate a dataset
data <- data.frame(X1 = rnorm(100), X2 = rnorm(100), X3 = rnorm(100))

## Joint learnings
dim <- c(3,2,3)
P <- jointmotbf.fit(data, dimensions = dim)
P
attributes(P)
class(P)
# }

Run the code above in your browser using DataLab