Learn R Programming

SAVE (version 0.9.3.7)

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

## S3 method for class 'SAVE':
predictcode(object, newdesign, n.iter=1000, sampledraws=T, tol=1e-10)

## S3 method for class 'predictcode.SAVE': summary(object)

## S3 method for class 'summary.predictcode.SAVE': show(object)

## S3 method for class 'predictcode.SAVE': 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
...
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:
  • newdesignA copy of the design.
  • samplesThe matrix that contains the simulations (see details).
  • mleA copy of the maximum likelihood estimate object@mle.
  • predictcodecallThe call to this function.
  • modelmeanThe mean of the emulator (see details) at the new design newdesign.
  • covmatThe covariance matrix of the emulator (see details) at the new design newdesign.

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
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