Learn R Programming

SAVE (version 0.9.3.7)

plot: Plots for an object of class SAVE

Description

Plots are provided to summarize graphically the Bayesian analysis of a computer model.

Usage

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

Arguments

x
An object of class SAVE
option
One of "trace", "calibration" or "precision"(see details)
...
Additional graphical parameters to be passed

Details

Three different plots are implemented. If option="trace" this function returns the trace plots of the simulated chains. This plot is useful for assessing the convergence of the sampling method. If option="calibration" this function plots an histogram of the sample obtained from the posterior distribution of the calibration parameters and a line representing the prior assumed. If option="precision" the histograms and priors correspond to the precision parameters.

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)

#A trace plot of the chains
plot(gfsw, option="trace")
#The histogram of the posterior density of calibration parameters
plot(gfsw, option="calibration")
#The histogram of the posterior density of precision parameters
plot(gfsw, option="precision")

Run the code above in your browser using DataLab