# gaussbary1d: Barycenter of Gaussian Distributions in \mathbf{R} In T4transport: Tools for Computational Optimal Transport

 gaussbary1d R Documentation

## Barycenter of Gaussian Distributions in \mathbf{R}

### Description

Given a collection of 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.

### Usage

gaussbary1d(means, vars, weights = NULL, ...)


### Arguments

 means a length-n vector of mean parameters. vars a length-n vector of variance parameters. weights a weight of each image; if NULL (default), uniform weight is set. Otherwise, it should be a length-n vector of nonnegative weights. ... extra parameters including abstolstopping criterion for iterations (default: 1e-8). maxitermaximum number of iterations (default: 496).

### Value

a named list containing

mean

mean of the estimated barycenter distribution.

var

variance of the estimated barycenter distribution.

### References

\insertAllCited

gaussbarypd() for multivariate case.

### Examples

#----------------------------------------------------------------------
#                         Two Gaussians
#
# Two Gaussian distributions are parametrized as follows.
# Type 1 : (mean, var) = (-4, 1/4)
# Type 2 : (mean, var) = (+4, 1/4)
#----------------------------------------------------------------------
# GENERATE PARAMETERS
par_mean = c(-4, 4)
par_vars = c(0.25, 0.25)

# COMPUTE THE BARYCENTER OF EQUAL WEIGHTS
gmean = gaussbary1d(par_mean, par_vars)

# QUANTITIES FOR PLOTTING
x_grid  = seq(from=-6, to=6, length.out=200)
y_dist1 = stats::dnorm(x_grid, mean=-4, sd=0.5)
y_dist2 = stats::dnorm(x_grid, mean=+4, sd=0.5)
y_gmean = stats::dnorm(x_grid, mean=gmean$mean, sd=sqrt(gmean$var))

# VISUALIZE