Learn R Programming

RChronoModel (version 0.1)

MarginalPlot: Plot of a marginal posterior density

Description

This function draws the density of a one-parameter and adds summary statistics.

Usage

MarginalPlot(a_chain, level = 0.95, title = "Marginal posterior density",
  colors = T, GridLength = 1024)

Arguments

a_chain
numeric vector containing the output of the MCMC algorithm for a one-parameter
level
probability corresponding to the level of confidence
title
label of the title
colors
if TRUE -> use of colors in the graph
GridLength
length of the grid used to estimate the density

Value

  • Draws a plot of the estimated marginal posterior density for the one-parameter and adds the mean and the credible interval at the desired level

Details

The density is estimated using density() function with n=GridLength.

Examples

Run this code
data(Events); attach(Events)

  MarginalPlot(Event.1, 0.95)
  MarginalPlot(Event.1, 0.50)

  MarginalPlot(Event.2, 0.95, title="Marginal density plot of Event 2")
  MarginalPlot(Event.2, 0.95, colors = FALSE)

Run the code above in your browser using DataLab