mixMatrix | R Documentation |
Given m
matrix distributions distributions of length N
,
creates a new Matdist by summing over the weighted cdfs. Note that this
method does not create a MixtureDistribution but a new Matdist.
Assumes Matrix distributions have the same number of columns, otherwise use
mixturiseVector(lapply(mds, as.VectorDistribution))
.
mixMatrix(mds, weights = "uniform")
mds |
|
weights |
|
This method returns a new Matdist which is less flexible than a
MixtureDistribution which has parameters (i.e. weights
) that can be
updated after construction.
Also works for Arrdists, where we convert these to Matdists, based on the
which.curve
initialization parameter.
mixturiseVector
m1 <- as.Distribution(
t(apply(matrix(runif(25), 5, 5, FALSE,
list(NULL, 1:5)), 1,
function(x) x / sum(x))),
fun = "pdf"
)
m2 <- as.Distribution(
t(apply(matrix(runif(25), 5, 5, FALSE,
list(NULL, 1:5)), 1,
function(x) x / sum(x))),
fun = "pdf"
)
# uniform mixing
m3 <- mixMatrix(list(m1, m2))
# un-uniform mixing
m4 <- mixMatrix(list(m1, m2), weights = c(0.1, 0.9))
m1$cdf(3)
m2$cdf(3)
m3$cdf(3)
m4$cdf(3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.