gaussbarypd | R Documentation |
\mathbf{R}^p
Given a collection of n
-dimensional Gaussian distributions \mathcal{N}(\mu_i, \Sigma_i^2)
for i=1,\ldots,n
, compute the Wasserstein barycenter of order 2.
For the barycenter computation of variance components, we use a fixed-point
algorithm by \insertCiteAlvarezEsteban;textualT4transport.
gaussbarypd(means, vars, weights = NULL, ...)
means |
an |
vars |
a |
weights |
a weight of each image; if |
... |
extra parameters including
|
a named list containing
a length-p
vector for mean of the estimated barycenter distribution.
a (p\times p)
matrix for variance of the estimated barycenter distribution.
gaussbary1d()
for univariate case.
#----------------------------------------------------------------------
# Two Gaussians in R^2
#----------------------------------------------------------------------
# GENERATE PARAMETERS
# means
par_mean = rbind(c(-4,0), c(4,0))
# covariances
par_vars = array(0,c(2,2,2))
par_vars[,,1] = cbind(c(4,-2),c(-2,4))
par_vars[,,2] = cbind(c(4,+2),c(+2,4))
# COMPUTE THE BARYCENTER OF EQUAL WEIGHTS
gmean = gaussbarypd(par_mean, par_vars)
# GET COORDINATES FOR DRAWING
pt_type1 = gaussvis2d(par_mean[1,], par_vars[,,1])
pt_type2 = gaussvis2d(par_mean[2,], par_vars[,,2])
pt_gmean = gaussvis2d(gmean$mean, gmean$var)
# VISUALIZE
opar <- par(no.readonly=TRUE)
plot(pt_gmean, lwd=2, col="red", type="l",
main="Barycenter", xlab="", ylab="",
xlim=c(-6,6))
lines(pt_type1)
lines(pt_type2)
par(opar)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.