Learn R Programming

distr6 (version 1.5.2)

mixturiseVector: Create Mixture Distribution From Multiple Vectors

Description

Given m vector distributions of length N, creates a single vector distribution consisting of n mixture distributions mixing the m vectors.

Usage

mixturiseVector(vecdists, weights = "uniform")

Arguments

vecdists

(list()) List of VectorDistributions, should be of same length and with the non-`distlist' constructor with the same distribution.

weights

(character(1)|numeric()) Weights passed to MixtureDistribution. Default uniform weighting.

Details

Let \(v1 = (D11, D12,...,D1N)\) and \(v2 = (D21, D22,...,D2N)\) then the mixturiseVector function creates the vector distribution \(v3 = (D31, D32, ..., D3N)\) where D3N = m(D1N, D2N, wN) where m is a mixture distribution with weights wN.

Examples

Run this code
# NOT RUN {
v1 <- VectorDistribution$new(distribution = "Binomial", params = data.frame(size = 1:2))
v2 <- VectorDistribution$new(distribution = "Binomial", params = data.frame(size = 3:4))
mv1 <- mixturiseVector(list(v1, v2))

# equivalently
mv2 <- VectorDistribution$new(list(
  MixtureDistribution$new(distribution = "Binomial", params = data.frame(size = c(1, 3))),
  MixtureDistribution$new(distribution = "Binomial", params = data.frame(size = c(2, 4)))
))

mv1$pdf(1:5)
mv2$pdf(1:5)
# }

Run the code above in your browser using DataLab