Learn R Programming

SAVE (version 0.9.3.7)

predictreality: Predict values of reality at new input points

Description

The emulator of the computer model and the Bayesian fit are used to produce samples from the posterior predictive distribution of the computer model and bias function evaluated at the new input points. Then, bias-corrected predictions of the response (reality) are produced by adding these two samples (model+bias).

Usage

## S3 method for class 'SAVE':
predictreality(object, newdesign, n.burnin=0, n.thin=1, tol=1E-10, ...)

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

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

Arguments

object
An object of the corresponding signature.
newdesign
A named matrix containing the points (controllable inputs) where predictions are to be performed. Column names should contain the object@controllablenames.
n.burnin
The burnin to be applied (see details below).
n.thin
The thinin to be applied (see details below).
tol
The tolerance in the Cholesky decomposition.
...
Extra arguments to be passed to the function (still not implemented).

Value

  • Returns an S4 object of class predictreality.SAVE with the following slots:
  • modelpredA list with the simulations from the posterior distribution of the computer model output evaluated at the new design
  • biaspredA matrix with the simulations from the posterior distribution of the bias function evaluated at the new design.
  • newdesignA copy of the design given as argument.
  • predictrealitycallThe call to the function.

Details

Draws from the posterior predictive distribution of the computer model and bias at a given set of controllable inputs are simulated using the MCMC sample from the posterior distribution of the parameters of the model stored in object@mcmcsample. This sample can be thinned by n.thin and/or the first n.burnin draws can be discarded.

A preliminary analysis of the resulting sample can be performed with summary which provides point estimates and tolerance bounds of the predictions.

See Also

validate

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

# summary of the results

summary(gfsw)

##############
# obtain the posterior distribution of the unknown parameters
##############

gfsw <- bayesfit(object=gfsw, prior=c(uniform("t", upper=8, lower=0.8)), 
				 n.iter=20000, n.burnin=100, n.thin=2)

#########
# bias-corrected prediction at a set of inputs
# using predictreality
##########

load <- c(4.0,5.3)
curr <- seq(from=20,to=30,length=20)
g <- c(1,2)

xnew <- as.data.frame(expand.grid(curr,load,g))
names(xnew)<-c("C","L","G")

# Obtain samples
prsw <- predictreality(object=gfsw, newdesign=xnew, tol=1.E-12)

#Summarize the results:
summary(prsw)

Run the code above in your browser using DataLab