Learn R Programming

MoTBFs (version 2.0)

eval.motbf: Evaluation of MoTBFs

Description

Evaluates a univariate ("mop", "mte") or joint distribution ("jointmotbf") at a specific point.

Usage

eval.motbf(P, values)

Value

If all the variables in the equation are evaluated, then a "numeric" value is returned. Otherwise, an "univmotbf" object or a "jointmotbf" object is returned.

Arguments

P

An object of class "univmotbf" or "jointmotbf".

values

A list with the name of the variables equal to the values to be evaluated.

Examples

Run this code
#' ## 1. EXAMPLE
## Dataset with 2 variables
X <- data.frame(rnorm(100), rexp(100))

## Joint function
dim <- c(3,3) # dim <- c(5,4)
P <- jointmotbf.fit(X, dimensions = dim)

## Evaluation
val <- list(x = -1.5, y = 3)
eval.motbf(P, values = val)
val <- list(x = -1.5)
eval.motbf(P, values = val)
val <- list(y = 3)
eval.motbf(P, values = val)

##############################################################################
## MORE EXAMPLES #############################################################
############################################################################## 
# \donttest{
## Dataset with 3 variables
X <- data.frame(x = rnorm(100), y = rexp(100), z = rnorm(100, 1))

## Joint function
dim <- c(2,1,3)
P <- jointmotbf.fit(X, dimensions = dim)
P

## Evaluation
val <- list(x = 0.8, y = -2.1, z = 1.2)
eval.motbf(P, values = val)
val <- list(x = 0.8, y = 1.2)
eval.motbf(P, values = val)
val <- list(y = -2.1)
eval.motbf(P, values = val)
# }

Run the code above in your browser using DataLab