plot.aMTM: Plot the chain of an aMTM object

Description Usage Arguments Details Author(s) See Also Examples

View source: R/plot.R

Description

An object of class aMTM contains the resulting chain X as well as the selected proposal at each iteration and the resulting proposal densities. This function produces various plots to inspect the output of an aMTM object.

Usage

1
2
## S3 method for class 'aMTM'
plot(aMTMobject, vars, type, color, pairs, prop.density, ...)

Arguments

aMTMobject

An object of class aMTM.

vars

A vector of indices of the variables to plot. A maximum of 10 variables is accepted and the default is all variables of X up to the first 10.

type

Whether to plot points ('p'), line segments between points ('l') or both ('l') where the upper triangular matrix contains the trace plots and the lower diagonal matrix contains the scatter plot. Only applies when pairs==TRUE; default is 'p'.

color

Whether to plot the points/lines colored with the corresponding proposal density. In the case of points, the color represent the density used to get to the point; in the case of lines, the color represent the density used for the jump. Default is TRUE.

pairs

Whether to plot the variables by pairs or not. Default is TRUE.

prop.density

Whether to add the resulting densities to the plots or not. Default is TRUE.

...

Additionnal graphical parameters.

Details

When pairs=TRUE, the 2-D marginal plots of X for each pair of variables in vars are plotted. On the diagonal, the 1-D marginal densities are plotted. When pairs=FALSE, the trace plot and the 1-D marginal plot are produced for each varaibles in vars.

Author(s)

Simon Fontaine, simfont@umich.edu

See Also

aMTM.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Not run: 
library(aMTM)
# Banana log-density with parameter B and a
p <- function(x, p) apply(x,1,function(x) -x[1]^2/(2*p$a^2) - 1/2*(x[2]+p$B*x[1]^2-p$B*p$a^2)^2)
# setup
set.seed(1)
N<-1e5;K<-3
B<-0.04;a<-8
# aMTM sampling with ASWAM update
mcmc <- aMTM(target=p, N=N, K=K, x0=c(0,0), parms=list(a=a,B=B), burnin=0.1)

#plot the pairs showing color
plot.aMTM(mcmc, color=T)
#plot the pairs showing jumps and color
plot.aMTM(mcmc, type='l', color=T)
#plot the marginals with colors
plot.aMTM(mcmc, pairs=F, color=T)

## End(Not run)

fontaine618/aMTM documentation built on May 23, 2020, 1:31 p.m.