View source: R/gauss.barycenter.R
Barycenter of Gaussian Distributions
1 2 3 4 5 6 7 8 | gauss.barycenter(
x,
y = NULL,
type = c("wass2fpt", "wass2rgd"),
maxiter = 200,
eps = 1e-10,
nthreads = 0
)
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ## generate univariate Gaussians
mylist1d = list()
for (i in 1:50){
my.ctd = stats::runif(1, min=-0.5, max=0.5)
my.sd = stats::runif(1, min=0.9, max=1.1)
mylist1d[[i]] = wrapgauss1d(mean=my.ctd, sd=my.sd)
}
wass2fpt = gauss.barycenter(mylist1d, type="wass2fpt")
wass2rgd = gauss.barycenter(mylist1d, type="wass2rgd")
## Not run:
## test with 5-dimensional Gaussians
mylist5d = list()
mycovs = list()
for (i in 1:50){
my.ctd = stats::runif(5, min=-0.5, max=0.5)
my.sig = stats::cov(matrix(T4Gauss::rnorm(100*5),ncol=5))
mycovs[[i]] = my.sig
mylist5d[[i]] = wrapgaussNd(mu=my.ctd, sigma=my.sig)
}
wass2fpt = gauss.barycenter(mylist5d, type="wass2fpt")
wass2rgd = gauss.barycenter(mylist5d, type="wass2rgd")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.