library(SAVE)
#############
# load data
#############
data(spotweldfield,package='SAVE')
data(spotweldmodel,package='SAVE')
##############
# create the SAVE object which describes the problem and
# compute the corresponding mle estimates
##############
gfsw <- SAVE(response.name="N", controllable.names=c("C", "L", "G"),
calibration.names=c("t"), field.data=spotweldfield,
model.data=spotweldmodel, mean.formula=as.formula("~1"),
bestguess=list(t=4.0))
##########
# emulate the output of the model using predictcode
##########
# construct design at which to emulate the model
u <- 3.2
load <- c(4.0,5.3)
curr <- seq(from=20,to=30,length=20)
g <- c(1,2)
xnewpure <- expand.grid(curr,load,g)
xnewpure <- cbind(xnewpure,rep(u,dim(xnewpure)[1]))
names(xnewpure) <- c("C","L","G","t")
xnewpure <- as.data.frame(xnewpure)
pcsw<- predictcode(object=gfsw, newdesign=xnewpure, n.iter=20000, tol=1.E-12)
#A summary of the emulation:
summary(pcsw)
#A plot of the emulation
plot(pcsw)Run the code above in your browser using DataLab