Learn R Programming

propagate (version 1.3-0)

plot.propagate: Plotting function for 'propagate' objects

Description

Creates a histogram (blue) of the Monte Carlo output, along with a density curve (red), the \(100(1 - \alpha)\) % coverage intervals (GUM uncertainty framework (GUF): dashed black; Monte Carlo, probabilistically symmetric: solid black), median (orange) and mean (green) of the Monte Carlo output, with \(\alpha\) = alpha of the propagate call.

Usage

# S3 method for propagate
plot(x, logx = FALSE, breaks = 100, ...)

Value

A plot as described above.

Arguments

x

an object returned from propagate.

logx

logical. If TRUE, the histogram and density curve show the log-transformed Monte Carlo output \(\log(y)\) on a linear abscissa (labelled "log(y)"), and the vertical lines are drawn at the logarithms of the interval limits, median and mean. Non-positive values give non-finite logarithms and are not shown.

breaks

numeric, passed to hist: a suggestion for the number of bins of the histogram.

...

other parameters to hist.

Author

Andrej-Nikolai Spiess

Details

To prevent a few extreme values from compressing the histogram, the Monte Carlo output is restricted to the values between its 0.1 % and 99.9 % quantiles, i.e. the 0.1 % most extreme values on each side are omitted from the histogram and density curve (not from the intervals, median and mean, which are those of the propagate results).

Examples

Run this code
EXPR1 <- expression(x^2 * sin(y))
x <- c(5, 0.01)
y <- c(1, 0.01)
DF1 <- cbind(x, y)
RES1 <- propagate(expr = EXPR1, data = DF1, type = "stat", 
                  nsim = 100000, alpha = 0.01, check = FALSE)
plot(RES1)

Run the code above in your browser using DataLab