wasp: Compute Wasserstein barycenters of subset posteriors

View source: R/wasp.R

waspR Documentation

Compute Wasserstein barycenters of subset posteriors

Description

This function computes Wasserstein Barycenters of subset posteriors and gives posterior summaries for the full posterior.

Usage

wasp(mcmc, par.names = NULL, acc = 0.001, iter = 10, out = FALSE)

Arguments

mcmc

a three dimensional array (rows = number of subset posteriors, columns = number of parameters of the posterior distribution, slices = samples number of samples for each subset posterior) containing posterior samples for all subsets

par.names

optional character vector with parameter names

acc

accuracy of the swapping algorithm (default = 0.001)

iter

maximum number of iterations of the swapping algorithm (default = 10)

out

boolean indicating whether output for each iteration of the swapping algorithm should be displayed (default = false)

Details

The swapping algorithm developed by Puccetti, Rüschendorf and Vanduffel (2020) is used to compute Wasserstein barycenters of subset posteriors.

Value

A wasp object, which can be further analyzed using the associated function summary.wasp.

A wasp object contains the following elements (some elements are not returned if not applicable)

barycenter

A matrix of posterior samples (rows) for all parameters (columns) of the full posterior obtained by the swapping algorithm.

raw

An array (dim = c(subsets, parameters, samples)) containing the raw output from the swapping algorithm.

call

The call to the wasp() function.

subsets

The amount of subset posteriors in mcmc.

parameters

The amount of parameters in mcmc.

samples

The amount of posterior samples for each subset posterior in mcmc.

acc

Accuracy of the swapping algorithm, default = 0.001.

iter

Maximum amount of iterations for the swapping algorithm, default = 10.

Source

Puccetti, G., Rüschendorf, L. & Vanduffel, S. (2020). On the computation of Wasserstein barycenters, Journal of Multivariate Analysis, 176.

Examples


library(waspr)
out <- wasp(pois_logistic,
            par.names = c("beta_s", "alpha_l", "beta_l",
                          "baseline_sigma", "baseline_mu",
                          "correlation", "sigma_s", "sigma_l"))
summary(out)


waspr documentation built on Sept. 11, 2023, 5:10 p.m.