The Ernest Nested Sampler Object
ernest_sampler-class.Rd
An R6 class that contains a nested sampling run.
This object is normally created by calling nested_sampling()
, and
interacted with by calling S3 methods like generate()
, calculate()
,
and glance()
.
Active bindings
n_iterations
The total number of sampling iterations.
n_calls
The total calls made to the likelihood function, or
0L
if no calls have been made yet.variables
The names of each variable in the prior space.
live_points
Access the live points list.
dead_points
Access the dead points list.
Methods
Method new()
Creates a new ernest_sampler
.
Usage
ernest_sampler$new(
lrps,
ptype,
n_points = 500L,
verbose = getOption("verbose")
)
Arguments
lrps
An
ernest_lrps
object describing the model and prior space.ptype
The parameters involved in nested sampling. Possible values are:
A single integer, describing the dimensions of the prior space.
A character vector, naming each dimension in the prior space.
A zero-row
tibble::tibble()
, where each column names a dimension of the prior space.
n_points
The number of live points to use during nested sampling. Higher values allow for more accurate estimates of the evidence integral at the cost of increased computational time.
verbose
Whether to display a progress bar during a run.
Method compile()
Prepare the ernest_sampler
for generating nested samples by validating
the set of live points within the object, creating live points if none
exist yet.
Method generate()
Generate samples from nested sampling until a given criterion is met.
Usage
ernest_sampler$generate(
max_iterations = Inf,
max_calls = Inf,
min_logz = 0.05,
refresh = FALSE
)
Arguments
max_iterations
The maximum number of iterations to perform. If set to Inf, this stopping criterion is ignored.
max_calls
The maximum number of calls to the likelihood function. If set to Inf, this stopping criterion is ignored.
min_logz
The minimum log-evidence value to achieve. Must be a number strictly larger than zero.
refresh
Whether to clear existing points from the sampler, starting a run from scratch.
Method calculate()
Calculate the marginal likelihood of a given model and return the estimates
in a tidy tibble()
.
Usage
ernest_sampler$calculate(
add_points = c("none", "unit", "original", "both"),
add_progress = FALSE
)
Arguments
add_points
A string, either
"none"
,"unit"
,"parameter"
, or"both"
. If"none"
, no additional columns are added. If"unit"
or"parameter"
, the parameter values associated with each point are added, in their respective units. If"both"
, both the unit and parameter values are added.add_progress
Adds columns for the number of calls to the likelihood function between each iteration.
Method summary()
Summarise the results of a nested sampling run.
Returns
A list with class summary.ernest_sampler()
.
Method format()
Encode the run as a string for pretty printing.
Method print()
Print a brief summary of the sampler to the string.
Arguments
...
Arguments forwarded to
format()