marginalJointMoTBF: Marginalization of MoTBFs

View source: R/joint.R

marginalJointMoTBFR Documentation

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

## 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 #############################################################
##############################################################################

## 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")


MoTBFs documentation built on April 18, 2022, 5:06 p.m.