# Mposterior-package: Robust and Scalable Bayes via a Median of Subset Posterior... In Mposterior: Mposterior: R package for Robust and Scalable Bayes via a Median of Subset Posterior Measures

## Description

Implementation of Weiszfeld algorithm for estimating M-posterior for robust and scalable Bayesian inference (see Minsker et al., 2014).

## Details

 Package: Mposterior Type: Package Version: 0.1.1 Date: 2014-05-31 License: GPL (>= 3) LazyLoad: yes

`findWeiszfeldMedian` is the workhorse function that estimates M-posterior given samples from the subset posteriors using the Weiszfeld algorithm of Minsker et al. (2014). M-posterior is the median of subset posteriors in the space of probability measures.

## Author(s)

Sanvesh Srivastava [email protected]

## References

Minsker, S., Srivastava, S., Lin, L., and Dunson, D.B. (2014). Robust and Scalable Bayes via a Median of Subset Posterior Measures. http://arxiv.org/abs/1403.2660

`findWeiszfeldMedian`

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13``` ```set.seed(12345) ## list that contains subset posterior samples from 2-dim Gaussian density subAtomList <- vector("list", 5) subAtomList[[1]] <- cbind(rnorm(100, mean = 1), rnorm(100, mean = 1)) subAtomList[[2]] <- cbind(rnorm(100, mean = -1), rnorm(100, mean= -1)) subAtomList[[3]] <- cbind(rnorm(100, mean = -1), rnorm(100, mean = 1)) subAtomList[[4]] <- cbind(rnorm(100, mean = 1), rnorm(100, mean = -1)) subAtomList[[5]] <- cbind(rnorm(100, mean = 2), rnorm(100, mean = 2)) library(Mposterior) medPosterior <- findWeiszfeldMedian(subAtomList, sigma = 0.1, maxit = 100, tol = 1e-10) medPosterior summary(medPosterior) plot(medPosterior) ```

### Example output

```Loading required package: Rcpp
##
## Mposterior: R package for Robust and Scalable Bayes via a Median of Subset Posterior Measures
## (Version 0.1.2, built: 2014-06-01)
## Copyright (C) 2013-2019 Sanvesh Srivastava
Weiszfeld iteration: 10
Weiszfeld iteration: 20
Weiszfeld iteration: 30
Weiszfeld iteration: 40
Weiszfeld algorithm coverged at iteration: 48
Subset posteriors:
Subset Natoms WeiszfeldWts
1      1    100         0.34
2      2    100         0.14
3      3    100         0.16
4      4    100         0.19
5      5    100         0.17
M-posterior has 2 dimensions
RBF kernel with sigma= 0.1
Weiszfeld algorithm converged in 48 iterations
Subset posteriors:
Subset Natoms WeiszfeldWts
1      1    100         0.34
2      2    100         0.14
3      3    100         0.16
4      4    100         0.19
5      5    100         0.17
M-posterior has 2 dimensions
RBF kernel with sigma = 0.1
Weiszfeld algorithm converged in 48 iterations
```

Mposterior documentation built on May 29, 2017, 6:38 p.m.