I've been recently studying Bayesian inference with PyMC3. I understand the flexibility that comes with multiple possible options for initial distribution choices, yet I can't seem to understand why one would need the sampling part. I realize this is a very naive question, yet I cant seem to understand why does one not stop at the MAP part -- here the model parameter values are found.

Why the NUTS,GIBBS or any other sampling? Why is this useful? I see that whole distributions are obtained for individual parameters, and can be visualized. I assume this has to do with some sort of parameter validation, where one inspects the quality of the parameters obtained?

My current understanding is that MAP estimates are used as starting points for the sampling part. Once the sampling is done, how does one obtain "more correct" parameter values based on the MCMC?

I would really like to use this methodology for modeling tasks I am dealing with, yet I just don't see positive sides of having to choose one of n possible priors, where each could potentially give different results (?)

Thank you very much.


Since it seems that you lack some basic understanding of the process behind Bayesian modeling work, let me give you a short summary of the usual workflow:

  1. You define the likelihood function for your model, for example: you assume the Bernoulli distribution parametrized by probability of success $\pi$ for the binary variable $Y$. So $Y$ is your data, e.g. series of coin flips: [0, 0, 1, 1, 0, 1, 1].

  2. You assume the prior distribution(s) for your parameter(s), say in our case, we assume beta distribution parametrized by hyperparameters $\alpha$ and $\beta$. Let's say that you assume a uniform prior, i.e. $\alpha = \beta = 1$.

Now you described the problems in probabilistic terms and defined your model. Notice that we didn't estimate anything yet, we just defined a set of assumptions about our data and the parameters.

  1. Next, what we need to do is to estimate the parameter $\pi$. For this, you can do one of the three things:

    • You can use conjugacy and obtain the closed-form posterior distribution by using pure math,

    • You can use some kind of optimization to find the maximum of the posterior distribution (the mode of the posterior distribution), i.e. use maximum a posteriori (MAP) -- this gives you a point estimate for $\pi$,

    • You can simulate draws from the posterior distribution using Markov Chain Monte Carlo (MCMC) algorithms (e.g. Metropolis-Hastings, Gibbs, or NUTS). By doing so you obtain the samples from the posterior distribution (in this case samples from the posterior distribution of the random variable $\pi$). You can use the samples to approximate the posterior distribution, or to estimate it's properties, e.g. calculate the mean from the samples, to estimate the expected value of the parameter of interest $E(\pi | Y)$ as your point estimate of $\pi$.

All the approaches have pros and cons. You can use conjugacy only for the very simple problems, but there is no closed-form solutions for things like multivariate logistic regression, so this won't work for many problems. As about MAP, it gives you only the point estimate and it depends on the optimizer you used, it may not always work for complicated problems that are hard to optimize (recall that when using maximum likelihood we often use dedicated optimizers for complicated problems rather then black-box ones). Simulation is the most commonly used approach in Bayesian estimation, it is slower then the two previous approaches, but it gives you the full posterior distribution. MCMC is the approach of choice for most Bayesians.

We use priors to quantify our assumptions about the parameters. They let us to put some out-of-data information into the model. On another hand, the more information does your data convey, the less influential are the priors.

  • $\begingroup$ Thanks! This actually clarifies a lot. Especially the parameter estimation part. $\endgroup$ – sdgaw erzswer Feb 26 '18 at 10:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.