Last data update: 2014.03.03

R: Diagnostic plots for the evaluation of the convergence of the...
check.convergenceR Documentation

Diagnostic plots for the evaluation of the convergence of the algorithm

Description

The check.convergence function provides two plots (selectable by which) to investigate the convergence of the posterior distribution towards the target distribution at different stages of the algorithm.

Usage

  check.convergence(x, which = c(1L:2L), nsplit = 10, nbloc = 4,
               ask = prod(par("mfcol")) < length(which) && dev.interactive())

Arguments

x

an object of class ESS

.

which

if a subset of the plots is required, specify a subset of the numbers '1:2'.

nsplit

number of splits: the number of sweep intervals to consider.

nbloc

number of moving windows to plot.

ask

ask: logical; if 'TRUE', the user is _ask_ed before each plot, see 'par(ask=.)'

Value

The function check.convergence produces plots to assess the stability of the density estimates of the log posterior distribution. Two sets of graphs are plotted: the first set displays the density estimates of the log posterior distribution based on (i) all the sweep (ii) first half of the sweeps (iii) second half of the sweeps. The second plot represents similar density estimates at different stages of the MCMC procedure according to a sliding window whose characteristics are defined by the number of splits nsplit (i.e. the number of sweep intervals to consider) and number of blocks nbloc (i.e. the number of density estimates to plot).

Author(s)

Benoit Liquet, b.liquet@uq.edu.au,
Marc Chadeau-Hyam m.chadeau@imperial.ac.uk,
Leonardo Bottolo l.bottolo@imperial.ac.uk,
Gianluca Campanella g.campanella11@imperial.ac.uk

Examples

# load an ESS object
modelY_Hopx <- example.as.ESS.object()
check.convergence(modelY_Hopx,nsplit=10,nbloc=4)
check.convergence(modelY_Hopx,nsplit=5,nbloc=4)
check.convergence(modelY_Hopx,nsplit=5,nbloc=2)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(R2GUESS)
Loading required package: fields
Loading required package: spam
Loading required package: grid
Spam version 1.3-0 (2015-10-24) is loaded.
Type 'help( Spam)' or 'demo( spam)' for a short introduction 
and overview of this package.
Help for individual functions is also obtained by adding the
suffix '.spam' to the function name, e.g. 'help( chol.spam)'.

Attaching package: 'spam'

The following objects are masked from 'package:base':

    backsolve, forwardsolve

Loading required package: maps

 # maps v3.1: updated 'world': all lakes moved to separate new #
 # 'lakes' database. Type '?world' or 'news(package="maps")'.  #


Loading required package: MCMCpack
Loading required package: coda
Loading required package: MASS
##
## Markov Chain Monte Carlo Package (MCMCpack)
## Copyright (C) 2003-2016 Andrew D. Martin, Kevin M. Quinn, and Jong Hee Park
##
## Support provided by the U.S. National Science Foundation
## (Grants SES-0350646 and SES-0350613)
##
Loading required package: mixOmics
Loading required package: lattice
Loading required package: ggplot2

Loaded mixOmics 6.0.0

Visit http://www.mixOmics.org for more details about our methods.
Any bug reports or comments? Notify us at mixomics at math.univ-toulouse.fr or https://bitbucket.org/klecao/package-mixomics/issues

Thank you for using mixOmics!

Attaching package: 'mixOmics'

The following object is masked from 'package:maps':

    map

Loading required package: mvtnorm
Loading required package: snowfall
Loading required package: snow
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/R2GUESS/check.convergence.Rd_%03d_medium.png", width=480, height=480)
> ### Name: check.convergence
> ### Title: Diagnostic plots for the evaluation of the convergence of the
> ###   algorithm
> ### Aliases: check.convergence
> 
> ### ** Examples
> 
> # load an ESS object
> modelY_Hopx <- example.as.ESS.object()
The run is ok 
You can now analyse the results 
> check.convergence(modelY_Hopx,nsplit=10,nbloc=4)
Read 143537 items
[1] 0
> check.convergence(modelY_Hopx,nsplit=5,nbloc=4)
Read 143537 items
[1] 0
> check.convergence(modelY_Hopx,nsplit=5,nbloc=2)
Read 143537 items
[1] 0
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>