Learn R Programming

FAmle (version 1.3.7)

plot.metropolis: A Function to Plot metropolis objects

Description

This function allows to user to call different plots for visual assessment of the posterior distribution(s).

Usage

# S3 method for metropolis
plot(x, plot.type = "carlin", pos = 1:x$iter, ...)

Arguments

x

mle object corresponding to the fitted model.

plot.type

The user may choose betweew: carlin returns the same plot as in Carlin and Louis (2009) (see References); ts returns plot.ts; pairs returns a pairs; hist returns an hist for each marginal posterior distribution; post.pred returns an histogram of the data's posterior predictive distribution.

pos

May be used by the user to plot a subset (i.e. a random subset, sample)) of the posterior distribution when pairs is called. This avoids using too much memory while building the plot.

Additional arguments pertaining to function plot.default.

References

See list of references for metropolis.

See Also

metropolis

Examples

Run this code
# NOT RUN {
data(yarns)
x <- yarns$x
fit.x <- mle(x,'gamma',c(.1,.1))
bayes.x <- metropolis(model=fit.x,iter=100,
	trans.list=list(function(x) exp(x),function(x) exp(x)))
plot(bayes.x)
plot(bayes.x,'hist',col='cyan')
plot(bayes.x,'pairs',cex=.1,pch=19)
plot(bayes.x,'pairs',pos=sample(1:bayes.x$iter,20),col='red')
plot(bayes.x,'post.pred',col='green')
# }

Run the code above in your browser using DataLab