uncert
calls.
"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, ...)
uncert
produced by a call to uncert()
.
plot()
(mostly barplot).
which=1
2*.Machine$double.eps
. Note that off-diagonal contributions
may be negative.
which=2
which=1
except 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.
which=3
which=4
which=5
which=6
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_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=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
.
uncert
, barplot
, plot.uncertMC
.
#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