Learn R Programming

SAVE (version 1.0)

predictcode: Predict values of the computer model at new input points

Description

The emulator of the computer model fitted by SAVE is used to predict values of the model at new input points.

Usage

"predictcode"(object, newdesign, n.iter=1000, sampledraws=T, tol=1e-10, verbose=FALSE)
"summary"(object)
"show"(object)
"plot"(x, ...)

Arguments

object
An object of the corresponding signature.
newdesign
A named matrix containing the points (calibration and controllable inputs) where predictions are to be performed. Column names should contain both the object@controllablenames and object@calibrationnames
n.iter
The number of simulations that are to be drawn from the emulator (see details below)
sampledraws
If TRUE a sample of size n.iter is obtained from the emulator. If FALSE only the covariance matrix and the mean of the emulator are returned.
tol
The tolerance in the Cholesky decomposition
verbose
A logical value indicating the level of output as the function runs.
...
Extra arguments to be passed to the function (still not implemented).
x
An object of class predictcode.SAVE

Value

Returns an S4 object of the class predictcode.SAVE that contains the following slots:

Details

The emulator of the computer model fitted by SAVE evaluated at the new input points specified in newdesign is a multivariate normal. Then predictcode computes the mean, the covariance matrix and, if sampledraws=TRUE, a simulated sample of size n.iter from this multivariate normal. A pivotal Cholesky decomposition algorithm is used in the simulation of the samples and tol is a tolerance parameter in this algorithm.

The object created can be explored with the functions plot and summary. The first function plots a graphic with the mean and 95% tolerance bounds of the emulator at each of the new input points. Furthermore, summary prints a matrix with the mean of the emulator at each new input point, the associated standard deviation, and 95% tolerance bounds.

See Also

SAVE

Examples

Run this code
## 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