Learn R Programming

mc2d (version 0.2.0)

plot.mc: 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 cumulative distribution function of the estimate of a mcnode or mc object ("U" and "VU" nodes).

Usage

# S3 method for 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 mcnode
plot(x, ...)
# S3 method for plotmc
plot(x, ...)
# S3 method for mccut
plot(x, stat=c("median", "mean"), lim=c(0.025, 0.25, 0.75, 0.975),
	  griddim=NULL, xlab=names(x), ylab="Fn(x)", main="",
	  draw=TRUE, ...)

Value

A plot.mc object, list of the quantiles used to plot the draw.

Arguments

x

a mcnode or a mc objects

prec

the precision of the plot. 0.001 will provide an ecdf from the 0.000, 0.001, .002, ..., 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 (2D mc or mcnode) . Maybe NULL or empty.

na.rm

Should NA values be discarded

griddim

a vector of two integers, indicating the size of the grid of the graph. If NULL, the grid is calculated to produce a "nice" graph.

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. xlim is either a vector of length 2, used for each graph, or a list of vectors of length 2, whose ith element is used for the ith graph. By default, the data range is used as xlim.

ylim

y coordinate range. ylim is either a vector of length 2, used for each graph, or a list of vectors of length 2, whose ith element is used for the ith graph. By default, the data range is 0-1.

...

further arguments to be passed to plot.stepfun.

Details

plot.mcnode is a user-friendly function that send the mcnode to plot.mc.

For "VU" and "U" mcnodes, quantiles are calculated using quantile.mc within each of the nsu simulations (i.e. by columns of each mcnode). The medians (but may be the means using stat="mean") calculated from the nsu values are plotted. The 0.025 and 0.975 quantiles, and the 0.25 and 0.75 quantiles (default values of lim) of these quantiles are used as the envelope.

References

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

See Also

ecdf, plot, quantile.mc

Examples

Run this code
data(total)

plot(xVUM3)
## only one envelope corresponding to quantiles 0.025 and 0.975
plot(xVUM3, lim=c(0.025, 0.975)) 
## only one envelope not painted
plot(xVUM3, lim=c(0.025, 0.975), paint=FALSE) 

def.par <- par(no.readonly = TRUE)
par(mar=c(4, 4, 1, 1))
plot(total)
par(def.par)



Run the code above in your browser using DataLab