marginal_plot {ArchaeoPhases}R Documentation

Plot a marginal posterior density

Description

Draws a plot of the marginal posterior density for a single parameter, with an option to add the mean and the credible interval at the desired level

Usage

marginal_plot(
  data,
  position = 1,
  level = 0.95,
  grid_length = 1024,
  title = if (is.numeric(position)) names(data)[position] else position,
  subtitle = "Marginal posterior density",
  caption = paste(level * 100, "% credible interval", sep = ""),
  x_label = "Calendar year",
  y_label = "Density",
  y_grid = TRUE,
  x_scale = "calendar",
  elapsed_origin_position = NULL,
  x_min = NULL,
  x_max = NULL,
  height = 7,
  width = 7,
  units = "in",
  file = NULL,
  plot_result = TRUE,
  mean_linetype = "dashed",
  mean_color = "white",
  mean_size = 0.5,
  ci_linetype = "dotted",
  ci_color = mean_color,
  ci_size = mean_size,
  line_linetype = "solid",
  line_color = "black",
  line_size = 1,
  density_color = "gray30",
  fill_palette = NULL
)

Arguments

data

Data frame containing the output of the MCMC algorithm.

position

Index of the column corresponding to the MCMC chain of interest, or a column name.

level

Probability corresponding to the level of confidence.

grid_length

Length of the grid used to estimate the density.

title

Title of the graph. The default uses the data column name.

subtitle

Subtitle of the graph. The default is "Marginal posterior density".

caption

Caption of the graph. The default describes the confidence of the credible interval.

x_label

Label of the x-axis.

y_label

Label of the y-axis.

y_grid

Switch for horizontal grid lines.

x_scale

One of "calendar" for calendar years, "BP" for years before present, or "elapsed" for time elapsed from a specified origin.

elapsed_origin_position

Position of the column to use as the origin for elapsed time calculations.

x_min

Minimum x axis value.

x_max

Maximum x axis value.

height

Plot height in units.

width

Plot width in units.

units

String recognized by the ggsave() function, one of "in", "cm", "mm". This parameter has no effect on the display plot.

file

Name of the file that will be saved if chosen, default = NULL.

plot_result

If TRUE, then draw a plot on the display, else suppress drawing.

mean_linetype

The linetype used to indicate the mean density.

mean_color

The color of the line used to indicate mean density.

mean_size

The width of the line used to indicate the mean density.

ci_linetype

The linetype used to indicate the credible intervals.

ci_color

The color of the lines used to indicate the credible intervals.

ci_size

The width of the lines used to indicate the credible intervals.

line_linetype

The linetype used to indicate the density.

line_color

The color of the line used to indicate the density.

line_size

The width of the line used to indicate the density.

density_color

Color to use if fill_palette is not specified.

fill_palette

Palette to use for fills.

Details

The plot is drawn with the current theme and color scales; the function does not alter or override theme elements.

Value

An archaeophases_plot object with the data and metadata needed to reproduce the plot.

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

Examples

  data(Events)
  mp <- marginal_plot(data = Events, position = 2, level = 0.95)
  ## View data and metadata
  str(mp)


[Package ArchaeoPhases version 1.5 Index]