Constructs a posterior-ordinate attribute from the natural logarithm of the posterior heights. It is the log-height counterpart of posterior_ordinate_attribute(), for posterior ordinates whose natural-scale height underflows: posterior_ordinate_attribute() requires finite positive heights, while a log height only has to be finite.

posterior_log_ordinate_attribute(
  value,
  log_ordinate,
  method,
  density_method,
  diagnostics = NULL,
  ...
)

Arguments

value

numeric null-hypothesis value or values.

log_ordinate

numeric natural logarithm of the posterior ordinate height or heights, one per value.

method

estimator label stored in the attribute.

density_method

public density method label stored in the attribute.

diagnostics

optional estimator diagnostics.

...

additional named metadata fields, for example parameter, conditional, or conditional_rule.

Value

posterior_log_ordinate_attribute() returns a list of class c("BayesTools_posterior_log_ordinate", "BayesTools_posterior_ordinate", "list") with the fields listed in the details, suitable for the posterior_ordinate metadata of posterior draws (posterior_metadata()).

Details

The attribute stores the fields status ("ok"), value, ordinate (equal to exp(log_ordinate), so it can underflow to 0 while log_ordinate stays finite), log_ordinate, method, density_method, diagnostics, and the additional metadata. Consumers that evaluate a Bayes factor from a stored ordinate (e.g., Savage_Dickey_BF()) use the log height when it is present, and posterior_transform() maps it with the Jacobian of the transformation.

The values are unique and finite and there is one log height per value. Additional metadata must be named with unique names and cannot replace the fields status, value, ordinate, log_ordinate, method, density_method, diagnostics, x, y, null_hypothesis, height, posterior_height, ordinates, posterior_ordinate, posterior_ordinates, and estimator.

Examples

# a height of exp(-1000) underflows to zero on the natural scale
attribute <- posterior_log_ordinate_attribute(
  value          = 0,
  log_ordinate   = -1000,
  method         = "example",
  density_method = "precomputed"
)
attribute$ordinate
#> [1] 0
attribute$log_ordinate
#> [1] -1000