plot.POUMM {POUMM}R Documentation

Plots of a POUMM-fit

Description

Plots of a POUMM-fit

Usage

## S3 method for class 'POUMM'
plot(
  x,
  type = c("MCMC"),
  doPlot = TRUE,
  interactive = TRUE,
  stat = c("alpha", "theta", "sigma", "sigmae", "g0", "H2tMean"),
  chain = NULL,
  startMCMC = NA,
  endMCMC = NA,
  thinMCMC = 1000,
  statFunctions = statistics(x),
  doZoomIn = FALSE,
  zoomInFilter = paste0("(stat %in% c('H2e','H2tMean','H2tInf','H2tMax') & ",
    "(value >= 0 & value <= 1) ) |",
    "( !stat %in% c('H2e','H2tMean','H2tInf','H2tMax') & ",
    "(value <= median(HPDUpper) + 4 * (median(HPDUpper) - median(HPDLower)) &",
    "value >= median(HPDLower) - 4 * (median(HPDUpper) - median(HPDLower))))"),
  prettyNames = TRUE,
  showUnivarDensityOnDiag = FALSE,
  ...
)

Arguments

x

An object of class POUMM.

type

A character indicating the type of plot(s) to be generated. Defaults to "MCMC", resulting in a trace and density plot for the selected statistics (see argument stat).

doPlot

Logical indicating whether a plot should be printed on the currently active graphics device or whether to return a list of ggplot objects for further processing. Defaults to TRUE.

interactive

Logical indicating whether the user should press a key before generating a next plot (when needed to display two or more plots). Defaults to TRUE. Meaningless if doPlot = FALSE.

stat

A character vector with the names of statistics to be plotted. These should be names from the stats-list (see argument statFunctions). Defaults to c("alpha", "theta", "sigma", "sigmae", "H2tMean", "H2tInf").

chain

A vector of integers indicating the chains to be plotted.

startMCMC, endMCMC, thinMCMC

Integers used to extract a sample from the MCMC-chain; passed to summary().

statFunctions

Named list of statistics functions; passed to summary().

doZoomIn

(type MCMC only) A logical value indicating whether the produced plots should have a limitation on the x-axis according to an expression set in zoomInFilter (see below). Default value is FALSE.

zoomInFilter

A character string which evaluates as logical value. If doZoomIn is set to TRUE, this filter is applied to each point in each MCMC chain and the data-point is filtered out if it evaluates to FALSE. This allows to zoomIn the x-axis of density plots but should be used with caution, since filtering out points from the MCMC-sample can affect the kernel densities. Unfortunately, filtering out values is currently the only way to affect the limits of individual facets in ggplot2. The default value is a complicated expression involving the HPD from all MCMC chains (normally one chain from the prior and 2 chains from the posterior): zoomInFilter = paste0("(stat "(value >= 0 & value <= 1) ) |", "( !stat "(value <= median(HPDUpper) + 4 * (median(HPDUpper) - median(HPDLower)) &", "value >= median(HPDLower) - 4 * (median(HPDUpper) - median(HPDLower))))"). The identifiers in this expression can be any column names found in a summary of a POUMM object.

prettyNames

A logical indicating if greek letters and sub/superscripts should be used for the names of columns in the posterior density pairs-plot.

showUnivarDensityOnDiag

A logical indicating if univariate density plots should be displaied on the main diagonal in the bivariate posterior plot. Defaults to FALSE, in which case the column names are displayed on the diagonal.

...

not used, needed for consistency with the generic plot-function.

Value

If doPlot==FALSE, a named list containing a member called data of class data.table and several members of class ggplot.


[Package POUMM version 2.1.7 Index]