Constructs exact support metadata of a scalar posterior distribution, for the support metadata of posterior samples (posterior_metadata()) and the support of posterior_density_attribute().

posterior_support_attribute(
  bounds,
  points = NULL,
  type = NULL,
  exact = TRUE,
  source = NULL
)

Arguments

bounds

numeric vector c(lower, upper) with lower <= upper; bounds may be infinite.

points

optional finite numeric vector of point-support locations.

type

support type: "interval", "points", or "mixed". If NULL, "points" is used when the finite bounds are exactly (not up to a tolerance) the range of points and "interval" otherwise.

exact

whether bounds and points describe the true support. Set exact = FALSE for plotting or integration limits; non-exact support is not used to exclude a null hypothesis value or to reflect a kernel density estimate.

source

optional label of the source of the support metadata.

Value

A BayesTools_posterior_support object.

Details

Posterior support metadata must be created with this constructor or by a BayesTools posterior producer; other objects stored as support metadata are rejected with an error. An unclassed list of such objects, named by column, can hold the support of several columns.

Examples

posterior_support_attribute(c(0, Inf))
#> $bounds
#> [1]   0 Inf
#> 
#> $points
#> numeric(0)
#> 
#> $exact
#> [1] TRUE
#> 
#> $source
#> NULL
#> 
#> $type
#> [1] "interval"
#> 
#> attr(,"class")
#> [1] "BayesTools_posterior_support" "list"                        
posterior_support_attribute(c(0, 1), points = c(0, 1), type = "points")
#> $bounds
#> [1] 0 1
#> 
#> $points
#> [1] 0 1
#> 
#> $exact
#> [1] TRUE
#> 
#> $source
#> NULL
#> 
#> $type
#> [1] "points"
#> 
#> attr(,"class")
#> [1] "BayesTools_posterior_support" "list"