traceplot: Traceplot of Gibbs Samples

View source: R/eratosthenes.R

traceplotR Documentation

Traceplot of Gibbs Samples

Description

Wrapper around plot to make a traceplot of Gibbs samples from gibbs_ad. See histogram for plotting a density histogram of events.

Usage

traceplot(
  x,
  events = NULL,
  xlim = NULL,
  ylim = NULL,
  xlab = "Index",
  ylab = "Year",
  palette = NULL,
  opacity = 1,
  legend_pos = "topright",
  ...
)

## S3 method for class 'marginals'
traceplot(
  x,
  events = NULL,
  xlim = NULL,
  ylim = NULL,
  xlab = "Index",
  ylab = "Year",
  palette = NULL,
  opacity = 1,
  legend_pos = "topright",
  ...
)

Arguments

x

A list object of class marginals or use_marginals, the output of gibbs_ad or gibbs_ad_use respectively.

events

A vector or element of the event names to plot. Maximum number of events is 12.

xlim

The limits of the x-axis (optional).

ylim

The limits of the y-axis (optional).

xlab

Label for the y-axis. Default is "Index".

ylab

Label for the y-axis. Default is "Year".

palette

A vector providing the color palette of the histogram. The default is "colorBlindness::paletteMartin" (see palettes_d).

opacity

The opacity/transparency of the traceplot, if visualizing overlapping events. A value between 0 and 1 (default).

legend_pos

The position of the legend in the plot. Default is "topright".

...

Additional graphical parameters passed to plot.

Details

Also see tidy_marginals for exporting the results of these functions into tidy data frame for custom plotting in e.g., ggplot2.

Value

A traceplot of the Gibbs samples of the selected events.

Examples

x <- c("A", "B", "C", "D", "E", "F", "G", "H", "I", "J")
y <- c("B", "D", "G", "H", "K")
z <- c("F", "K", "L", "M")
contexts <- list(x, y, z)

f1 <- list(id = "find01", assoc = "D", type = c("type1", "form1"))
f2 <- list(id = "find02", assoc = "E", type = c("type1", "form2"))
f3 <- list(id = "find03", assoc = "G", type = c("type1", "form1"))
f4 <- list(id = "find04", assoc = "H", type = c("type2", "form1"))
f5 <- list(id = "find05", assoc = "I", type = "type2")
f6 <- list(id = "find06", assoc = "H", type = NULL)

artifacts <- list(f1, f2, f3, f4, f5, f6)
 
# external constraints
coin1 <- list(id = "coin1", assoc = "B", type = NULL, samples = runif(100,-320,-300))
coin2 <- list(id = "coin2", assoc = "G", type = NULL, samples = seq(37, 41, length = 100))
destr <- list(id = "destr", assoc = "J", type = NULL, samples = 79)

tpq_info <- list(coin1, coin2)
taq_info <- list(destr)

result <- gibbs_ad(contexts, finds = artifacts, tpq = tpq_info, taq = taq_info)

traceplot(result, "B")
traceplot(result, c("coin1", "B", "H"), opacity = 0.5)


eratosthenes documentation built on June 28, 2025, 1:08 a.m.