4
$\begingroup$

I am trying to understand how fitting a model using MCMC works. Is there a loss function that is optimized?

Or is it simply a case of more draws from the distribution amount to a more complete description of the posterior and therefore more accurate parameters?

In particular I am referring to how a BSTS time series model is fitted using MCMC draws as described in Scott and Varian "Predicting the Present with Bayesian Structural Time Series", 2013.

In that paper a state space model of a time series is described:

$y_t = Z_t^T \alpha_t + \epsilon_t $.

$\alpha_{t+1} = T_t \alpha_t + R_t\eta_t$

Let

$\theta = (Z, T, R, \epsilon, \eta)$

and

$\textbf{y} = y_1,....y_n$ their time series data.

They then use MCMC to simulate the posterior distribution of the parameters of the model given their data $p(\theta|\textbf{y})$ - and presumably (they don't actually states this, I am assuming) they select $\theta$ that maximizes $p(\theta|\textbf{y})$.

In R the BSTS model takes a number of MCMC draws as an input parameter - and I am trying to figure how to choose that number.

If it is the second case (more draws = better simulation of the distribution), how do we decided the number of iterations and how do we avoid overfitting?

$\endgroup$
11
  • 2
    $\begingroup$ You are confusing inference (estimation) and simulation (MCMC), precision in the estimation and precision of the Monte Carlo approximation. $\endgroup$
    – Xi'an
    Commented Jul 6, 2018 at 8:39
  • 1
    $\begingroup$ Your question has reopened. @Xi'an's comment still stands. 'Train the model' is estimation (it certainly will be in this instance). $\endgroup$
    – Glen_b
    Commented Jul 6, 2018 at 21:39
  • 1
    $\begingroup$ Sorry, I don't see how that changes the point being made about confusing precision in the estimation and precision of the Monte Carlo approximation. $\endgroup$
    – Glen_b
    Commented Jul 6, 2018 at 23:19
  • 1
    $\begingroup$ This is clearer but there is no such thing as overfitting associated with an MCMC chain. The more the better. $\endgroup$
    – Xi'an
    Commented Jul 7, 2018 at 14:44
  • 1
    $\begingroup$ @Alex Bayesian estimation has notable links to loss functions. You should learn how $\hat{\theta}$ is taken from $p(\theta|y)$. In minimax theory, different estimators optimize different losses: the median with L1 loss, the mean with L2 loss and the mode with Linf loss: all of these are used in practice. The use of MCMC is just to numerically calculate the shape of $p(\theta|y)$: we can assume it has no bearing on the actual "loss" function that is minimized by the estimator $\hat{\theta} = f(p(\theta|y))$. $\endgroup$
    – AdamO
    Commented Jul 9, 2018 at 17:50

1 Answer 1

2
$\begingroup$

For Bayesian estimation, the point of MCMC is only to simulate data from--and thereby obtain an estimate of--the posterior. In general, MCMC (Markov Chain Monte Carlo) only refers to generating realizations or simulating data from a probability model. This is necessary for Bayesian analyses where the posterior if often not solvable in a closed form. Gibbs Sampling is perhaps the most popular technique for obtaining a posterior and it happens to be MCMC, but there are other approaches.

These simulation methods are imprecise, but we do not call this loss (in the same way that a blurry image could be called "lossy"). We call this precision. Increasing the number of iterations of Gibbs sampling will generally increase the precision with which the density of the posterior can be estimated. The lack of precision is called MCMC error.

Rather, loss is a general concept of Bayesian estimation. In practice, we make no distinction between posteriors which are estimated from MCMC or posteriors which are known in exact form when we discuss the loss of estimators. The risk (expected loss) is calculated the same way. Optimal Bayes estimators minimize risk.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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