Skip to contents

Computes evidence and related quantities from a nested sampling run, optionally by simulating the volumes of each nested likelihood shell.

Usage

# S3 method for class 'ernest_run'
calculate(x, ..., ndraws = NULL)

Arguments

x

An ernest_run object.

...

These dots are for future extensions and must be empty.

ndraws

An optional positive integer. The number of log-volume sequences to simulate. If equal to zero, no simulations will be made, and a one draw vector of log-volumes are produced from the estimates contained in x. If NULL, getOption("posterior.rvar_ndraws") is used (default 4000).

Value

A tibble::tibble(), containing n_iter + n_points rows and several columns:

  • log_lik: The log-likelihood of the model.

  • log_volume: The log-volume of the prior space.

  • log_weight: The log weights of the live points.

  • log_evidence: The log-evidence of the model.

  • log_evidence_err: The standard error of the log-evidence (only available when ndraws = 0).

The tibble has the additional class ernest_estimate, which has its own plot method.

Each column is returned as an posterior::rvar() vector.

References

Higson, E., Handley, W., Hobson, M., & Lasenby, A. (2019). Nestcheck: Diagnostic Tests for Nested Sampling Calculations. Monthly Notices of the Royal Astronomical Society, 483(2), 2044–2056. https://doi.org/10.1093/mnras/sty3090

Examples

# Load an example run
data(example_run)

# View results as a tibble with `ndraws = FALSE` (the default).
calculate(example_run)
#> Nested sampling estimates <ernest_estimate>
#> No. of Simulated Draws: 4000
#> Log. Volume: -16 ± 1.3
#> Log. Evidence: -8.9 ± 0.098
#> # A tibble: 5,136 × 4
#>       log_lik        log_volume   log_weight log_evidence
#>    <rvar[1d]>        <rvar[1d]>   <rvar[1d]>   <rvar[1d]>
#>  1  -146 ± NA  -0.0019 ± 0.0019  -152 ± 0.82  -152 ± 0.82
#>  2  -144 ± NA  -0.0039 ± 0.0028  -151 ± 0.80  -150 ± 0.69
#>  3  -139 ± NA  -0.0059 ± 0.0034  -145 ± 0.79  -145 ± 0.78
#>  4  -136 ± NA  -0.0080 ± 0.0040  -142 ± 0.81  -142 ± 0.77
#>  5  -129 ± NA  -0.0100 ± 0.0044  -135 ± 0.82  -135 ± 0.82
#>  6  -126 ± NA  -0.0120 ± 0.0048  -133 ± 0.80  -133 ± 0.74
#>  7  -125 ± NA  -0.0140 ± 0.0053  -131 ± 0.79  -131 ± 0.68
#>  8  -125 ± NA  -0.0160 ± 0.0056  -131 ± 0.80  -130 ± 0.59
#>  9  -118 ± NA  -0.0180 ± 0.0060  -125 ± 0.81  -125 ± 0.81
#> 10  -118 ± NA  -0.0200 ± 0.0063  -124 ± 0.80  -124 ± 0.65
#> # ℹ 5,126 more rows

# Generate 100 simulated log-volume values for each iteration.
calculate(example_run, ndraws = 100)
#> Nested sampling estimates <ernest_estimate>
#> No. of Simulated Draws: 100
#> Log. Volume: -16 ± 1.1
#> Log. Evidence: -8.9 ± 0.091
#> # A tibble: 5,136 × 4
#>       log_lik        log_volume   log_weight log_evidence
#>    <rvar[1d]>        <rvar[1d]>   <rvar[1d]>   <rvar[1d]>
#>  1  -146 ± NA  -0.0022 ± 0.0023  -152 ± 0.84  -152 ± 0.84
#>  2  -144 ± NA  -0.0043 ± 0.0030  -151 ± 0.77  -150 ± 0.66
#>  3  -139 ± NA  -0.0061 ± 0.0035  -145 ± 0.82  -145 ± 0.81
#>  4  -136 ± NA  -0.0080 ± 0.0039  -142 ± 0.79  -142 ± 0.76
#>  5  -129 ± NA  -0.0097 ± 0.0041  -135 ± 0.81  -135 ± 0.80
#>  6  -126 ± NA  -0.0117 ± 0.0046  -133 ± 0.78  -133 ± 0.75
#>  7  -125 ± NA  -0.0133 ± 0.0049  -132 ± 0.82  -131 ± 0.73
#>  8  -125 ± NA  -0.0153 ± 0.0055  -131 ± 0.95  -130 ± 0.69
#>  9  -118 ± NA  -0.0171 ± 0.0058  -125 ± 0.78  -125 ± 0.77
#> 10  -118 ± NA  -0.0185 ± 0.0059  -124 ± 0.84  -124 ± 0.69
#> # ℹ 5,126 more rows