View source: R/MarginalStatistics.R

marginal_statistics | R Documentation |

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

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

`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. |

The *(100 * level)*\
using `hdr()`

function from hdrcde package.

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.

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

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

Thomas S. Dye, tsd@tsdye.online

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

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

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.