
Extract the posterior sample weights from a nested sampling run
Source:R/weights.R
weights.ernest_run.RdReturn the normalised posterior importance weights for the dead points in a nested sampling run.
Usage
# S3 method for class 'ernest_run'
weights(object, log = FALSE, ...)Arguments
- object
[ernest_run]
A nested sampling run.- log
[logical(1)]
Whether to return the weights on the log scale.- ...
These dots are for future extensions and must be empty.
Value
[double()] A numeric vector of normalised importance weights. When
log = FALSE, the values are exponentiated so they sum to one.
Details
The log-weights in a nested sampling run are the individual contributions of each sample to the log-evidence estimate. The unnormalised weight of the \(i\)th sampled point is given as $$w_i = \frac{L_{i-1} + L_i}{2} * (V_{i-1} - V_i)$$ where \(L_i\) is the likelihood value for the point and \(V_i\) is the prior volume at which the point was sampled.
The posterior importance weights are obtained by normalising the log-weights with the final log-evidence estimate. They can be used to reweight posterior samples from the run so they approximate the posterior distribution.