plot.mc: Plots Results of a Monte Carlo Simulation

View source: R/plot.mc.R

plot.mcR Documentation

Plots Results of a Monte Carlo Simulation

Description

Plots the empirical cumulative distribution function of a ‘⁠mcnode⁠’ or a ‘⁠mc⁠’ object (‘⁠"0"⁠’ and ‘⁠"V"⁠’ nodes) or the empirical CDF of the estimate of a ‘⁠mcnode⁠’ or ‘⁠mc⁠’ object (‘⁠"U"⁠’ and ‘⁠"VU"⁠’ nodes).

Usage

## S3 method for class 'mc'
plot(
  x,
  prec = 0.001,
  stat = c("median", "mean"),
  lim = c(0.025, 0.25, 0.75, 0.975),
  na.rm = TRUE,
  griddim = NULL,
  xlab = NULL,
  ylab = "Fn(x)",
  main = "",
  draw = TRUE,
  paint = TRUE,
  xlim = NULL,
  ylim = NULL,
  ...
)

## S3 method for class 'mcnode'
plot(x, ...)

## S3 method for class 'plotmc'
plot(x, ...)

Arguments

x

a ‘⁠mcnode⁠’ or a ‘⁠mc⁠’ object.

prec

the precision of the plot. ‘⁠0.001⁠’ gives an ecdf from the 0.000, 0.001, ..., 1.000 quantiles.

stat

the function used for estimates (2D ‘⁠mc⁠’ or ‘⁠mcnode⁠’). By default the median.

lim

a vector of numbers (between 0 and 1) indicating the envelope. May be ‘⁠NULL⁠’ or empty.

na.rm

should NA values be discarded?

griddim

a vector of two integers for the grid size. If ‘⁠NULL⁠’, calculated automatically.

xlab

vector of labels for the x-axis. If ‘⁠NULL⁠’, use the name of the node.

ylab

vector of labels for the y-axis.

main

vector of main titles of the graph.

draw

should the plot be drawn?

paint

should the envelopes be filled?

xlim

x coordinate range: a vector of length 2 or a list of such vectors.

ylim

y coordinate range: a vector of length 2 or a list of such vectors.

...

further arguments to be passed to ‘⁠plot.stepfun⁠’.

Details

For ‘⁠"VU"⁠’ and ‘⁠"U"⁠’ nodes, quantiles are calculated using quantile.mc within each of the ‘⁠nsu⁠’ simulations (by columns). The medians (or means if ‘⁠stat="mean"⁠’) are plotted, with ‘⁠lim⁠’ quantiles as the envelope.

Value

a ‘⁠plot.mc⁠’ object (list of quantiles used to draw the plot), invisibly.

References

Cullen AC and Frey HC (1999) Probabilistic techniques in exposure assessment. Plenum Press, USA, pp. 81-155.

See Also

ecdf, plot, quantile.mc, ggplotmc for a ggplot2 version.

Examples

data(total)
plot(xVUM3)
## Only one envelope for 0.025 and 0.975
plot(xVUM3, lim=c(0.025, 0.975))

mc2d documentation built on Oct. 23, 2026, 1:06 a.m.