marginal_statistics: Marginal summary statistics

View source: R/MarginalStatistics.R

marginal_statisticsR Documentation

Marginal summary statistics

Description

Calculates summary statistics of the output of the MCMC algorithm for a single parameter. Results are given in calendar years (BC/AD).

Usage

marginal_statistics(a_chain, level = 0.95, round_to = 0)

Arguments

a_chain

Numeric vector containing the output of the MCMC algorithm for the parameter.

level

Probability corresponding to the level of confidence used for the credible interval and the highest posterior density region.

round_to

Integer indicating the number of decimal places.

Details

The (100 * level)\ using hdr() function from hdrcde package.

Value

A list with the following components:

mean

The mean of the MCMC chain.

map

The maximum a posteriori of the MCMC chain.

sd

The standard deviation of the MCMC chain.

quantiles

A vector with the following elements: min = minimum value of the MCMC chain; q1 = first quantile of the MCMC chain; median = median of the MCMC chain; q2 = second quantile of the MCMC chain; and max = maximum value of the MCMC chain.

level

Confidence level for the credible interval and highest posterior density.

ci

A vector with the following elements: inf = lower credible interval of the MCMC chain at level; and sup = upper credible interval of the MCMC chain at level.

hpdr

A variable length vector with the lower and upper highest posterior density regions of the MCMC chain at level. List components are named inf_n and sup_n for n = 1 to the number of highest posterior density regions.

Author(s)

Anne Philippe, Anne.Philippe@univ-nantes.fr,

Marie-Anne Vibet, Marie-Anne.Vibet@univ-nantes.fr, and

Thomas S. Dye, tsd@tsdye.online

References

Hyndman, R. J. (1996) Computing and graphing highest density regions. American Statistician, 50, 120-126.

Examples

  data(Events); attach(Events)
  marginal_statistics(Event.1)
  marginal_statistics(Event.2, level = 0.90)
  ## convenient vector
  foo <- marginal_statistics(Event.1)
  unlist(foo)


ArchaeoPhases documentation built on June 22, 2022, 1:05 a.m.