Description Usage Arguments Details Value
Computes the so-called model likelihood, that is the probability of the data given the model, P(D | M) = \int P(D | θ, M) P(θ | M) dθ, based on samples from an MCMC run. The ratio between two model likelihoods from different models is the Bayes factor and can be used for model selection.
1 | model_likelihood(samples, burn.in = 0)
|
samples |
A data frame with the samples from an MCMC run. |
burn.in |
The number of samples to discard as burn-in samples. |
Computes the so-called model likelihood, that is the probability of the data given the model, P(D | M) = \int P(D | θ, M) P(θ | M) dθ.
Since the samples from the MCMC are from the posterior and not the prior distribution the likelihood cannot be computed simply as the mean of the likelihood – and typically that would be a very inefficient approach to computing the likelihood – so instead the harmonic mean of the likelihood sampled from the posterior is used. This follows from
\int P(θ | D, M) / P(D | θ, M) dθ = \int 1/P(D | M) [P(D | θ, M)P(θ | M)]/P(D | θ, M) dθ = 1/P(D | M)
so 1/P(D | M) = \int 1/P(D | θ, M) P(θ | D, M) dθ which is approximated from samples from the posterior P(θ | D, M).
The model log-likelihood \log P(D | M).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.