plot.abc: Diagnostic plots for ABC

View source: R/abc.R

plot.abcR Documentation

Diagnostic plots for ABC

Description

A plotting utile for quick visualization of the quality of an ABC analysis from an object of class "abc" generated with methods "loclinear" or "neuralnet" (see abc for details). Four plots are currently available: a density plot of the prior distribution, a density plot of the posterior distribution, a scatter plot of the Euclidean distances as a function of the parameter values, and a Normal Q-Q plot of the residuals from the regression.

Usage

## S3 method for class 'abc'
plot(x, param, subsample = 1000, true = NULL, file = NULL,
postscript = FALSE, onefile = TRUE, ask =
!is.null(deviceIsInteractive()), ...)

Arguments

x

an object of class "abc" generated with methods "loclinear" or "neuralnet" (see abc for details).

param

a vector or matrix of parameter values from the simulations that were used in the original call to abc.

subsample

the number of rows (simulations) to be plotted. Rows are randomly selected from param.

true

a vector of true parameter values, if known. Vertical lines are drawn at these values.

file

a character string giving the name of the file. See postscript for details on accepted file names. If NULL (the default) plots are printed to the null device (e.g. X11). If not NULL plots are printed on a pdf device. See also postscript.

postscript

logical; if FALSE (default) plots are printed on a pdf device, if TRUE on a postscript device.

onefile

logical, if TRUE (the default) allow multiple figures in one file. If FALSE, generate a file name containing the page number for each page. See postscript for further details.

ask

logical; if TRUE (the default), the user is asked before each plot, see par(ask=.).

...

other parameters passed to plot.

Details

In order to use this function, one of the regression correction methods had to be used in the original call to abc, i.e. "loclinear" or "neuralnet" (see abc for details). Four plots are printed for each parameter. (i) A density plot of the prior distribution. (ii) A density plot of the posterior distribution using the regression correction (red thick lines) and, for reference, using the simple rejection method (black fine lines). The prior distribution (in the posterior distributions' range) is also displayed (dashed lines). (iii) A scatter plot of the log Euclidean distances as a function of the true parameter values. Points corresponding to the accepted simulations are displayed in red. (iv) A Normal Q-Q plot of the residuals from the regression, thus from lsfit when method was "loclinear", and from nnet when method was "neuralnet" in the original abc.

For plots (i) and (iii) not the whole data but a subsample is used, the size of which can be is given by subsample. This is to avoid plots that may take too much time to print.

If a parameter transformation was applied in the original call to abc, the same transformations are applied to the parameters for plotting (on plots (i)-(iii)).

See Also

abc, hist.abc, summary.abc

Examples

## see ?abc for examples

abc documentation built on May 20, 2022, 1:11 a.m.