MoTBFs (version 1.4.1)

marginalJointMoTBF: Marginalization of MoTBFs

Description

Computes the marginal densities from a "jointmotbf" object.

Usage

marginalJointMoTBF(P, var)

Arguments

P

An object of class "jointmotbf", i.e., the joint density function.

var

The "numeric" position or the "character" name of the marginal variable.

Value

The marginal of a "jointmotbf" function. The result is an object of class "motbf".

See Also

jointMoTBF and evalJointFunction

Examples

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

## Joint function
dim <- c(4,3)
param <- parametersJointMoTBF(X, dimensions = dim)
P <- jointMoTBF(param)
P

## Marginal
marginalJointMoTBF(P, var = "x")
marginalJointMoTBF(P, var = 2)

##############################################################################
## MORE EXAMPLES #############################################################
##############################################################################
# }
# NOT RUN {
## Generate a dataset with 3 variables
data <- data.frame(rnorm(100), rnorm(100), rnorm(100))

## Joint function
dim <- c(2,1,3)
param <- parametersJointMoTBF(data, dimensions = dim)
P <- jointMoTBF(param)
nVariables(P)

## Marginal
marginalJointMoTBF(P, var="x")
marginalJointMoTBF(P, var="y")
marginalJointMoTBF(P, var="z")
# }

Run the code above in your browser using DataLab