Learn R Programming

ArchaeoPhases (version 1.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 = "Characteristics of a date",
  colors = TRUE, exportFile = NULL, exportFormat = "PNG", GridLength = 1024)

Arguments

a_chain

numeric vector containing the output of the MCMC algorithm for a one-parameter. The MCMC samples should be in calendar year (BC/AD).

level

probability corresponding to the level of confidence

title

label of the title

colors

if TRUE -> use of colors in the graph

exportFile

the name of the file to be saved. If NULL then no graph is saved.

exportFormat

the format of the export file : SVG or PNG.

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, level = 0.95)
  MarginalPlot(Event.1, level = 0.50)

  MarginalPlot(Event.2, level = 0.95, title="Characteristics of Event 2")
  MarginalPlot(Event.2, level = 0.95, colors = FALSE)
  MarginalPlot(Event.2, level = 0.95, colors = FALSE, 
  exportFile = "Characteristics_Event.2", exportFormat = "SVG")

Run the code above in your browser using DataLab