This package provides functions for smart sampling and sensitivity analysis for metrology applications, including computationally expensive problems.

Package: | ATmet |

Type: | Package |

Version: | 1.2 |

Date: | 2014-01-06 |

License: | GPL-3 |

The function for smart sampling implements the Latin Hypercube Sampling (LHS) method using the lhs package. The functions for sensitivity analysis implement the Standardized Rank Regression Coefficient (SRRC) and the Sobol' sensitivity indices using the sensitivity package. These methods can be used for computationally expensive problems.

This work is part of a joint research project within the European Metrology Research Programme (EMRP) called "Novel Mathematical and Statistical Approaches to Uncertainty Evaluation". The EMRP is jointly funded by the EMRP participating countries within EURAMET and the European Union.

Severine Demeyer and Alexandre Allard

Maintainer: severine.demeyer@lne.fr alexandre.allard@lne.fr

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 | ```
# **********************
# Smart sampling method
# **********************
N<- 100
k<- 4
x<- list("X1","X2","X3","X4")
distrib<- list("norm","norm","unif","t.scaled")
distrib.pars<- list(list(0,2),list(0,1),list(20,150),list(2,0,1))
LHSdesign(N,k,distrib,distrib.pars,x)
# **********************
# Sensitivity analysis
# **********************
##Simulate the input sample
M=10000
Xmass <- data.frame(X1 = rnorm(M, 100, 5e-5),
X2 = rnorm(M, 0.001234, 2e-5),
X3 = runif(M, 1100, 1300),
X4 = runif(M,7000000,9000000),
X5 = runif(M,7950000,8050000))#Data-frame
#Define the measurement model (GUM-S1, 9.3)
calibMass <-function(x){
return(((x[,1]+x[,2])*(1+(x[,3]-1200)*(1/x[,4]-1/x[,5]))-100)*1e3)
}
##### Use SRRC with a model function #####
#Apply sensitivityMet function to evaluate the associated SRRC indices
S_SRRC=sensitivityMet(model=calibMass,x=Xmass, nboot=100, method="SRRC", conf=0.95)
##Print the results
#First order indices
S_SRRC$S1
##### Use Sobol with a computational code #####
#Creation of the design for the computation of Sobol sensitivity indices
S_Sobol=sensitivityMet(model=NULL,x=Xmass,y=NULL, nboot=100, method="Sobol", conf=0.95)
#Obtain the design of experiment to submit to the code
XDesign=S_Sobol$SI$X
#Run the computational code with XDesign as a sample of the input quantities
#We use calibMass function (see GUM-S1) as an example
YDesign=calibMass(XDesign)
#Run the Sobol indices calculations with the outputs of the code
S_Sobol$SI=tell(x=S_Sobol$SI,y=YDesign)
##Print the results
#First order indices
S_Sobol$SI$S
#Total order indices
S_Sobol$SI$T
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.