| extract_distribution {HuraultMisc} | R Documentation | 
Extract a distribution represented by samples
Description
The distribution can be extracted as:
- a probability density function ("continuous"). 
- a probability mass function ("discrete"). 
- a series of equal-tailed confidence/credible intervals ("eti"). 
- a series of highest density confidence/credible intervals ("hdi"). 
Usage
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  | 
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
extract_distribution(runif(1e2), type = "continuous", support = c(0, 1))