Plot method for 'uncert' objects
Plots for uncertainty budgets produced by
1 2 3 4 5 6 7 8
## 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, ...)
An object of class
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 title for the plot
logical; if 'TRUE', the user is _ask_ed before each plot, see 'par("ask=")'
A list of captions for all the different plots.
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
For uncert objects created with methods other than MC, the plot types are:
A barplot of all non-zero contributions to the combined uncertainty. These are derived from the covariance matrix and the coefficients c_i. For terms on the diagonal of the covariance matrix, these are (c_i*u_i)^2; for off-diagonal terms (the correlation terms), 2*(c_i*u_i)*(c_j*u_j)*r_ij. The threshold for deciding an off-diagonal term is nonzero is that its magnitude is greater than
2*.Machine$double.eps. Note that off-diagonal contributions may be negative.
which=1except that the square root of the absolute value is plotted. For the 'diagonal' terms, these are just eqnu_i(y) in the nomenclature used by the GUM.
A barplot of u_i(y)^2, without the correlation terms.
A barplot of the sum of all (co)variance contributions associated with each x[i], that is,
contrib[i]=(c[i]u[i])^2+sum( 2(c[i]u[i])(c[j]u[j])r[i,j], j != i )
A barplot of the theoretical correlations cov(x[i],y)/(u[i]u.y).
A barplot of the theoretical covariances cov(x[i],y).
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
or calculated as
outer(u,u,"*")*cor) and sensitivity coefficients c[i]
as cov(x[i],y) = sum_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[i]*u.y).
Perhaps the most informative plots are for
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
Invisibly returns the default return value for the last plot produced.
S. L. R. Ellison, firstname.lastname@example.org
1 2 3 4 5 6 7 8 9 10
#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
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.