Consider the following, in which we run into problems when trying to calculate on a computer. Suppose I want to calculate a predictive density for new data (e.g., in a model comparison in a Bayesian context): Here is the posterior distribution (the distribution of the parameter, , given the data, , and predictors, ). All of , , and will generally be vectors.
If we have a set of samples for from the posterior distribution, , , we can estimate that quantity for a vector of conditionally IID observations using a Monte Carlo estimate of the expectation:
Explain why I should calculate the product in the equation above on the log scale. What is likely to happen if I just try to calculate it directly?
Here’s a re-expression, using the log scale for the inner quantity, which can be re-expressed as where What is likely to happen when I try to exponentiate ?
Consider the log predictive density, Figure out how you could calculate this log predictive density without running into the issues discussed in parts (a) and (b).
Hint: recall that with the logistic regression example in class, we scaled the problematic expression to remove the numerical problem. Here you can do something similar with the terms, though at the end of the day you’ll only be able to calculate the log of the predictive density and not the predictive density itself.
Comments