| marginal_likelihood | R Documentation |
Computes the log marginal likelihood \log p(y) of a Bayesian
estimate – the quantity whose differences across models on the same
data are log Bayes factors. Two estimators are reported:
marginal_likelihood(est, taus = seq(0.1, 0.9, by = 0.2))
est |
A |
taus |
Truncation probabilities for the modified harmonic mean. |
Modified harmonic mean (Geweke 1999) from the posterior draws, computed for a range of truncation probabilities; a small spread across truncations indicates a reliable estimate.
Laplace approximation at the posterior mode in transformed space (parametrization-invariant because the Jacobian is included), with a numerically differenced Hessian.
Truncated priors created with truncate() are renormalized
numerically at construction, so they contribute proper densities
here.
An object of class qpm_logml: $logml (harmonic-mean
estimate, averaged over taus), $by_tau, $laplace, and the
spread across truncations.
Geweke, J. (1999). Using simulation methods for Bayesian econometric models. Econometric Reviews, 18(1), 1-73.
m <- qpm_model(variables = vars(x = "x"), shocks = shocks(e),
equations = eqs(x ~ rho * x[-1] + e),
params = list(rho = 0.5))
obs <- simulate(qpm_solve(qpm_calibrate(m, rho = 0.8)), nsim = 120, seed = 1)
est <- qpm_estimate(m, obs, priors(rho = beta(0.5, 0.2)),
iter = 300, chains = 2, seed = 2, verbose = FALSE)
marginal_likelihood(est)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.