# NOT RUN {
###### The code to calibrate
X <- cbind(seq(0,1,length.out=5),seq(0,1,length.out=5))
code <- function(X,theta)
{
return((6*X[,1]*theta[2]-2)^2*theta[1]*sin(theta[3]*X[,2]-4))
}
Yexp <- code(X,c(1,1,11))+rnorm(5,0,0.1)
###### For the first model
### Generate the model
model1 <- model(code,X,Yexp,"model1")
### Plot the results with the first column of X
model1 %<% list(theta=c(1,1,11),var=0.01)
plot(model1,X[,1],CI="err")
### Summury of the foo class generated
print(model1)
###### For the second model
### code function is available, no DOE generated upstream
binf <- c(0.9,0.9,10.5)
bsup <- c(1.1,1.1,11.5)
opt.gp <- list(type="matern5_2", DOE=NULL)
opt.emul <- list(p=3,n.emul=150,binf=binf,bsup=bsup,type="maximinLHS")
model2 <- model(code,X,Yexp,"model2",
opt.gp=opt.gp,
opt.emul=opt.emul)
model2 %<% list(theta=c(1,1,11),var=0.1)
### Plot the model
plot(model2,X[,1])
### code function is available and use a specific DOE
DOE <- DiceDesign::lhsDesign(20,5)$design
DOE[,3:5] <- unscale(DOE[,3:5],binf,bsup)
opt.gp <- list(type="matern5_2", DOE=DOE)
model2 <- model(code,X,Yexp,"model2",
opt.gp=opt.gp)
model2 %<% list(theta=c(1,1,11),var=0.1)
plot(model2,X[,1])
### no code function but DOE and code output available
Ysim <- matrix(nr=20,nc=1)
for (i in 1:20)
{
covariates <- as.matrix(DOE[i,1:2])
dim(covariates) <- c(1,2)
Ysim[i] <- code(covariates,DOE[i,3:5])
}
opt.sim <- list(Ysim=Ysim,DOEsim=DOE)
opt.gp <- list(type="matern5_2", DOE=NULL)
model2 <- model(code=NULL,X,Yexp,"model2",
opt.gp=opt.gp,
opt.sim=opt.sim)
model2 %<% list(theta=c(1,1,11),var=0.1)
plot(model2,X[,1])
###### For the third model
model3 <- model(code,X,Yexp,"model3",opt.disc=list(kernel.type="gauss"))
model3 %<% list(theta=c(1,1,11),thetaD=c(20,0.5),var=0.1)
plot(model3,X[,1],CI="err")
print(model3)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab