extract_distribution: Extract a distribution represented by samples

Description Usage Arguments Value Alternative See Also Examples

Description

The distribution can be extracted as:

Usage

1
2
3
4
5
6
7
extract_distribution(
  object,
  parName = "",
  type = c("continuous", "discrete", "eti", "hdi"),
  transform = identity,
  ...
)

Arguments

object

Object specifying the distribution as samples: can be a Stanfit object, a matrix (columns represents parameters, rows samples) or a vector.

parName

Name of the parameter to extract.

type

Indicates how the distribution is summarised.

transform

Function to apply to the samples.

...

Arguments to pass to extract_pmf(), extract_pdf() or extract_ci() depending on type.

Value

Dataframe

Alternative

This function can notably be used to prepare the data for plotting fan charts when type = "eti" or "hdi". In that case, the ggdist package offers an alternative with ggdist::stat_lineribbon().

See Also

extract_draws() for extracting draws of an object.

Examples

1
extract_distribution(runif(1e2), type = "continuous", support = c(0, 1))

HuraultMisc documentation built on Sept. 6, 2021, 9:09 a.m.