|
1 | 1 | #' Estimate Evidence using a Nested Sampling Run |
2 | 2 | #' |
| 3 | +#' Computes evidence and related quantities from a nested |
| 4 | +#' sampling run, optionally by simulating the volumes of each nested |
| 5 | +#' likelihood shell. |
| 6 | +#' |
3 | 7 | #' @param x (ernest_run) An `ernest_run` object. |
4 | 8 | #' @inheritParams rlang::args_dots_empty |
5 | 9 | #' @param ndraws (positive integer or zero, optional) The number of log volume |
|
22 | 26 | #' Each column is returned as an [posterior::rvar()] vector. |
23 | 27 | #' |
24 | 28 | #' @details |
25 | | -#' Use `calculate()` to simulate the estimation error nested sampling runs caused |
26 | | -#' by approximating the change in log volume between iterations. Given the |
27 | | -#' use of ordered log likelihood restricted prior sampling, these volumes can be |
28 | | -#' modelled as the order statistics of a uniform random variable. Ernest uses the |
29 | | -#' following distributions to perform this simulation: |
| 29 | +#' Use `calculate()` to simulate the estimation error nested sampling runs |
| 30 | +#' caused by approximating the change in log volume between iterations. Given |
| 31 | +#' the use of ordered log likelihood restricted prior sampling, these volumes |
| 32 | +#' can be modelled as the order statistics of a uniform random variable. |
| 33 | +#' Ernest uses the following distributions to perform this simulation: |
30 | 34 | #' |
31 | 35 | #' * Constant number of live points: At each iteration, the point with the |
32 | 36 | #' lowest likelihood is replaced by a new sample constrained to a higher |
33 | 37 | #' likelihood region. Under this setup, the shrinkage in prior volume at |
34 | 38 | #' iteration `i` can be shown to follow the Beta distribution. |
35 | 39 | #' * Decreasing number of live points: At the end of the sampling run, the |
36 | | -#' remaining live points are added to the dead point set. This introduces a discrete |
37 | | -#' stepwise behavior in volume shrinkage. Ernest uses a transformation of variables |
38 | | -#' drawn from the exponential distribution to simulate the corresponding changes |
39 | | -#' in volume. |
| 40 | +#' remaining live points are added to the dead point set. This introduces a |
| 41 | +#' discrete stepwise behavior in volume shrinkage. Ernest uses a transformation |
| 42 | +#' of variables drawn from the exponential distribution to simulate the |
| 43 | +#' corresponding changes in volume. |
40 | 44 | #' |
41 | 45 | #' @references See Appendix A6 of Speagle, J. (2020). |
42 | 46 | # |
@@ -158,9 +162,11 @@ summary.ernest_estimate <- function(object, ...) { |
158 | 162 | format.ernest_estimate <- function(x, ...) { |
159 | 163 | cli::cli_format_method({ |
160 | 164 | cli::cli_div(theme = list(.val = list(digits = 3))) |
161 | | - cli::cli_bullets( |
162 | | - "An {.cls ernest_calculate}: {attr(x, 'ndraws')} draws x {length(x$log_lik)} iterations" |
163 | | - ) |
| 165 | + ndraws <- attr(x, "ndraws") |
| 166 | + iter <- length(x$log_lik) |
| 167 | + cli::cli_bullets(c( |
| 168 | + "An {.cls ernest_calculate}: {ndraws} draws x {iter} iterations" |
| 169 | + )) |
164 | 170 | }) |
165 | 171 | } |
166 | 172 |
|
|
0 commit comments