Generic method for obtaining the marginal distribution of a distribution object x over components indices.

marginal(x, indices)

Arguments

x

The distribution object.

indices

The indices of the marginal distribution to obtain.

Value

A distribution object for the marginal over indices.

Examples

x <- mvn(c(0, 0), diag(2))
m <- marginal(x, 1)  # marginal over first component
mean(m)               # 0
#> [1] 0