Learn R Programming

SAVE (version 0.9.3.7)

plot.predictreality.SAVE: A function for plotting summaries of an object of class predictreality.SAVE.

Description

Two different plots to summarize graphically the results in an object of class predictreality.SAVE.

Usage

## S3 method for class 'predictreality.SAVE':
plot(x, option = "trace", ...)

Arguments

x
An object of class predictreality.SAVE
option
One of "biascorr" or "biasfun" (see details)
...
Additional graphical parameters to be passed

Details

If option="biascorr" this function returns a plot with point predictions and 95% tolerance bounds of reality at the given set of controllable inputs. If option="biasfun" the plot represents the estimated bias and 95% credible bounds.

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

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

#Plot the results:
#Represent reality and tolerance bounds:
plot(prsw, option="biascorr")
#Represent bias and tolerance bounds:
plot(prsw, option="biasfun")

Run the code above in your browser using DataLab