# mixCov: Aggregating covariances matrices and/or error vectors into a... In propagate: Propagation of Uncertainty

## Description

This function aggregates covariances matrices, single variance values or a vector of multiple variance values into one final covariance matrix suitable for propagate.

## Usage

 1 mixCov(...) 

## Arguments

 ... either covariance matrices, or a vector of single/multiple variance values.

## Details

'Mixes' (aggregates) data of the following types into a final covariance matrix:
1) covariance matrices \mathbf{Σ} that are already available.
2) single variance values σ^2.
3) a vector of variance values σ^2_1, σ^2_2, ..., σ^2_n.

This is accomplished by filling a m_1 + m_2 + … + m_n sized square matrix \mathbf{C} succesively with elements 1 … m_1, m_1 + 1 … m1 + m2, …, m_n + 1 … m_n + m_{n + 1} with either covariance matrices at C_{m_n + 1 … m_n + m_{n + 1}, m_n + 1 … m_n + m_{n + 1}} or single variance values on the diagonals at C_{m_n, m_n}.

## Value

The aggregated covariance matrix.

## Author(s)

Andrej-Nikolai Spiess

## References

Evaluation of measurement data - Guide to the expression of uncertainty in measurement.
JCGM 100:2008 (GUM 1995 with minor corrections).
http://www.bipm.org/utils/common/documents/jcgm/JCGM_100_2008_E.pdf.

Evaluation of measurement data - Supplement 1 to the Guide to the expression of uncertainty in measurement - Propagation of distributions using a Monte Carlo Method.
JCGM 101:2008.
http://www.bipm.org/utils/common/documents/jcgm/JCGM_101_2008_E.pdf.

## Examples

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 ####################################################### ## Example in Annex H.4.1 from the GUM 2008 manual ## (see 'References'), measurement of activity. ## This will give exactly the same values as Table H.8. data(H.4) attach(H.4) T0 <- 60 lambda <- 1.25894E-4 Rx <- ((Cx - Cb)/60) * exp(lambda * tx) Rs <- ((Cs - Cb)/60) * exp(lambda * ts) mRx <- mean(Rx) sRx <- sd(Rx)/sqrt(6) mRx sRx mRs <- mean(Rs) sRs <- sd(Rs)/sqrt(6) mRs sRs R <- Rx/Rs mR <- mean(R) sR <- sd(R)/sqrt(6) mR sR cor(Rx, Rs) ## Definition as in H.4.3. As <- c(0.1368, 0.0018) ms <- c(5.0192, 0.005) mx <- c(5.0571, 0.001) ## We have to scale Rs/Rx by sqrt(6) to get the ## corresponding covariances. Rs <- Rs/sqrt(6) Rx <- Rx/sqrt(6) ## Here we create an aggregated covariance matrix ## from the raw and summary data. COV1 <- cov(cbind(Rs, Rx)) COV <- mixCov(COV1, As[2]^2, ms[2]^2, mx[2]^2) COV ## Prepare the data for 'propagate'. MEANS <- c(mRs, mRx, As[1], ms[1], mx[1]) SDS <- c(sRs, sRx, As[2], ms[2], mx[2]) DAT <- rbind(MEANS, SDS) colnames(DAT) <- c("Rs", "Rx", "As", "ms", "mx") ## This will give exactly the same values as ## in H.4.3/H.4.3.1. EXPR <- expression(As * (ms/mx) * (Rx/Rs)) RES <- propagate(EXPR, data = DAT, cov = COV, nsim = 100000) RES 

propagate documentation built on May 7, 2018, 1:03 a.m.