| marginal.jointmotbf | R Documentation |
Computes the marginal densities from a "jointmotbf" object.
marginal.jointmotbf(P, var)
P |
An object of class |
var |
A vector containing the names of the marginal variables (those being retained in 'P').
This argument accepts the |
If 'var' is an atomic vector, the marginal distribution of the variable specified in 'var' is computed
from the joint distribution and the result is an object of class "univmotbf", i.e., a univariate distribution.
If 'var' contains more than one variable, the joint distribution over this subset is computed, i.e.,
the variables NOT contained in 'var' are marginalized out and the result is an object of class "jointmotbf".
jointmotbf.fit and eval.motbf
## 1. EXAMPLE
## Dataset with 2 variables
data <- data.frame(x = rnorm(100), y = rnorm(100))
## Joint function
dim <- c(4,3)
P <- jointmotbf.fit(data, dimensions = dim)
## Marginal
marginal.jointmotbf(P, var = "x")
marginal.jointmotbf(P, var = 2)
##############################################################################
## MORE EXAMPLES #############################################################
##############################################################################
## Generate a dataset with 3 variables
data <- data.frame(x = rnorm(100), y = rnorm(100), z = rnorm(100))
## Joint function
dim <- c(2,2,3)
P <- jointmotbf.fit(data, dimensions = dim)
## Marginal
marginal.jointmotbf(P, var = "x")
marginal.jointmotbf(P, var = "y")
marginal.jointmotbf(P, var = c("x", "z"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.