Learn R Programming

metRology (version 0.9-16.1)

plot.uncert: Plot method for 'uncert' objects

Description

Plots for uncertainty budgets produced by uncert calls.

Usage

## S3 method for class 'uncert':
plot(x, which = c(1,2,4,5), main = paste(deparse(substitute(x))), 
    ask = prod(par("mfcol")) < length(which) && dev.interactive(), 
    caption = list("Variance and covariance contributions", 
    expression(sqrt(group("|", "Variance and covariance contributions", "|"))), 
    expression("Contribution " * u[i](y) == c[i] * u[i]), 
    "Combined contribution", "Correlation (x,y)", 
    "Covariances (x,y)"), cex.caption = 1, ...)

Arguments

x
An object of class uncert produced by a call to uncert().
which
Integer in 1:6; the particular variant(s) of plot required. A vector is permitted, in which case plots are produced in ascending order.
main
Main title for the plot
ask
logical; if 'TRUE', the user is _ask_ed before each plot, see 'par("ask=")'
caption
A list of captions for all the different plots.
cex.caption
Text size for captions. Note that if the number of figures per page is over 2, captions are further scaled by 0.8
...
Further parameters passed to plot() (mostly barplot).

Value

  • Invisibly returns the default return value for the last plot produced.

Details

For uncert objects created with methods other than MC, the plot types are: [object Object],[object Object],[object Object],[object Object],[object Object],[object Object] Values of which outside this range are silently ignored. For the X-Y correlation and covariance plots, the covariances are calculated from the covariance matrix $V$ (supplied to uncert() as cov or calculated as outer(u,u,"*")*cor) and sensitivity coefficients $c_i$ as $cov(x_i,y) = \sum\nolimits _{j} V_{j,i}c_j$. In fact the calculation used is simpler: cov.xy <- V %*% ci. The correlations are calculated in turn from these using $cov(x_i,y)/u(x_i)u_y$. Perhaps the most informative plots are for which=1, which=2, which=4 and which=5. The first of these includes all nonzero signed contributions, making the negative contributions visible; the second (which=2) makes direct comparison of magnitudes easier. The combined contribution plot is the effect on the total variance of removing all terms associated with a particular variable; it shows how much $u_y^2$ would reduce if the uncertainty for $x_i$ were reduced to zero. Note that in some cases with negative correlation the combined uncertainty can increase, on dropping a variable, shown by a negative reduction in the plot. (which=5) is among the most direct indications of the relative importance of individual parameters. Objects created with the MC method are passed to plot.uncertMC.

References

None.

See Also

uncert, barplot, plot.uncertMC.

Examples

Run this code
#An example with negative correlation
  x <- list(a=1, b=3, c=2, d=11)
  u <- lapply(x, function(x) x/10)
  u.cor<-diag(1,4)
  u.cor[3,4]<-u.cor[4,3]<- -0.5
  u.form.c<-uncert(~a+b*2+c*3+d/2, x, u, method="NUM", cor=u.cor)
  
  par(mfrow=c(3,2))
  plot(u.form.c, which=1:6, las=1, horiz=TRUE)  #Note use of barplot parameters

Run the code above in your browser using DataLab