## momentify R package at BAYSM14

I presented an arxived paper of my postdoc at the big success Young Bayesian Conference in Vienna. The big picture of the talk is simple: there are situations in Bayesian nonparametrics where you don’t know how to sample from the posterior distribution, but you can only compute posterior expectations (so-called *marginal methods*). So e.g. you cannot provide credible intervals. But sometimes all the moments of the posterior distribution are available as posterior expectations. So morally, you should be able to say more about the posterior distribution than just reporting the posterior mean. To be more specific, we consider a hazard (h) mixture model

where is a kernel, and the mixing distribution is random and discrete (Bayesian nonparametric approach).

We consider the survival function which is recovered from the hazard rate by the transform

and some possibly censored survival data having survival . Then it turns out that all the posterior moments of the survival curve evaluated at any time can be computed.

The nice trick of the paper is to use the representation of a distribution in a [Jacobi polynomial] basis where the coefficients are linear combinations of the moments. So one can sample from [an approximation of] the posterior, and with a posterior sample we can do everything! Including credible intervals.

I’ve wrapped up the few lines of code in an R package called momentify (not on CRAN). With a sequence of moments of a random variable supported on [0,1] as an input, the package does two things:

- evaluates the approximate density
- samples from it

A package example for a mixture of beta and 2 to 7 moments gives that result:

Marksaid, on 16 November 2019 at 13:31Where is momentify now? It has never been on CRAN, but now it is not available even from Dropbox…

New Family of Generalized Gaussian Distributions - Data Science Centralsaid, on 28 November 2019 at 10:51[…] Another way to simulate this type of distribution is to compute its moments (easy with Mathematica or WolframAlpha) using the formula in section 4, see also here. Then use the Momentify R package, available here. […]

New Family of Generalized Gaussian Distributionssaid, on 28 November 2019 at 10:57[…] Another way to simulate this type of distribution is to compute its moments (easy with Mathematica or WolframAlpha) using the formula in section 4, see also here. Then use the Momentify R package, available here. […]

New Family of Generalized Gaussian or Cauchy Distributionssaid, on 28 November 2019 at 21:04[…] Another way to simulate this type of distribution is to compute its moments (easy with Mathematica or WolframAlpha) using the formula at the bottom of section 4, see also here. Then use the Momentify R package, available here. […]