AdaptivMC | R Documentation |
adapted from GUM suppl.2 7.8 Adaptive Monte Carlo procedure
AdaptivMC(
nOutput = 2,
ndig = 2,
p = 0.95,
outliers = TRUE,
FUN,
n.iter = 10^4,
MC = TRUE,
...
)
nOutput |
integer (with default value) number of model output(default nOutput=2) |
ndig |
integer (with default value) number of significant decimal digits (default ndig=2) |
p |
integer (with default value) coverage probability (default p= 0.95) |
outliers |
logical(with default) logical parameters indicating whether or not outliers are discarded. TRUE, the outliers are keeping, FALSE, the outliers are rejected ( default outliers=TRUE) |
FUN |
function (required) a simulation MC model |
n.iter |
integer (with default) number of iteration for each simulation (default n.iter= 1e4) |
MC |
logical (with default value) MC=TRUE Monte-Carlo simulation; MC=FALSE Martkov Chain Monte Carlo |
... |
further parameters passed to the FUN function |
a list including
ndig integer number of significant decimal digits
M integer the number of draws M= h x n.iter (h number of simulation and n.iter number of iteration for each simulation)
y vector an estimate of measurand Y
uy vector the standard uncertainties associated with the estimates,
Ry matrix correlation coefficients rij = r(yi, yj) associated with pairs of the estimates,
kp integer a coverage factor defining a 100p % coverage region for Y,
as stored file
trial_h mcmc list of the simulations
JCGM-WG1 (2011) data – Supplement 2 to the “Guide to the expression of uncertainty in measurement” – Extension to any number of output quantities. Guide JCGM 102:2011. Sèvres: BIPM, IEC, IFCC, ILAC, ISO, IUPAC, IUPAP and OIML.
Geyer, C. (2011) Introduction to Markov Chain Monte Carlo, in: Handbook of Markov Chain Monte Carlo. pp. 3–48.
## example 9.2.2 GUM suppl.2 case1
Model<-
function(n.iter){
X1<-rnorm(n.iter,0,1)
X2<-rnorm(n.iter,0,1)
X3<-rnorm(n.iter,0,1)
Y1<-X1+X3
Y2<-X2+X3
cbind(Y1,Y2)
}
AdaptivMC(nOutput=2,ndig=3,p=0.95,FUN=Model,n.iter=1000)
## Not run:
AR(1) example
AR1<-
function(n.iter,rho=1,sig=1){
X<-Xn<-rnorm(1,0,sig)
Y<-0
for (i in 2:n.iter){
Yn<-rnorm(1,0,sig)
Xn<-rho*Xn+Yn
X<-rbind(X,Xn)
Y<-rbind(Y,Yn)
}
out<-cbind(X,Y)
}
AdaptivMC(nOutput=2,ndig=2,p=0.95,FUN=AR1,n.iter=1000,rho=0.99)
## End(Not run)
## Not run:
require(TLpack)
data(TLetru)
table<-Lum(TLetru,Doseb0=360,Dosea=0,alpha=FALSE,supra=FALSE)
B<-table$b
N<-table$n
table.norm<-B
for (j in 1:3){
for (i in 1:3)
{
table.norm[,i,j]<-(B[,i,j])/sum(N[seq(350,400),1,(j-1)*3+i])
}
}
table.data<-cbind(table.norm[,,1],table.norm[,,2],table.norm[,,3])
ii<-c(1,4,7,2,5,8,3,6,9)
table.data<-table.data[seq(1,475),ii]
Dose<-as.numeric(colnames(table.data))
df.T<-matrix(rep(seq(26,500),9),475,9)
df.y<-table.data[,1:9]
AdaptivMC(nOutput=5,ndig=2,outliers=FALSE,FUN=Slice5,Dose=Dose,df.T=df.T,df.y=df.y,n.thin=1)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.