## Not run: 
# 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="diameter", controllable.names=c("current", "load", "thickness"), 
# 			 calibration.names="tuning", field.data=spotweldfield, 
# 			 model.data=spotweldmodel, mean.formula=~1, 
# 			 bestguess=list(tuning=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("current","load","thickness","tuning")
# 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)
# ## End(Not run)	
	
Run the code above in your browser using DataLab