bmkconverge: bmkcoverge: Convergence via the Hellinger distance

Description Usage Arguments Details References Examples

View source: R/bmkconverge.R

Description

MCMC chain convergence diagnostic.

Usage

1
  bmkconverge(inputlist1, binsize = 1000)

Arguments

inputlist1

A list of the MCMC chains

binsize

a scalar giving how large each bin should be for consecutive batches. outputs the Hellinger distances between the sampled distribution for one scenario against the other.

Details

This takes an MCMC chain and divides it into batches of size binsize and calculates the Hellinger distance between consecutive batches.

References

Boone EL, Merrick JR and Krachey MJ. A Hellinger distance approach to MCMC diagnostics. Journal of Statistical Computation and Simulation, DOI:10.1080/00949655.2012.729588.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
library(dismo); library(MCMCpack);
data(Anguilla_train)
b0mean <- 0
b0precision <- (1/5)^2
mcmclen = 1000
burn=10000
MCMC.one <- MCMClogit(Angaus ~ SegSumT+DSDist+USNative+as.factor(Method)+DSMaxSlope+USSlope,
                data=Anguilla_train,burnin=burn, mcmc=mcmclen, beta.start=-1,
                b0=b0mean, B0=b0precision)
 
## End(Not run)
 data(MCMCsamples)
 mcmclen <- 1000
 bmkconverge(MCMC.one,mcmclen/10)

Example output

Loading required package: coda
Loading required package: plyr
Loading required package: functional
Loading required package: raster
Loading required package: sp
Loading required package: MASS

Attaching package: 'MASS'

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

    area, select

##
## Markov Chain Monte Carlo Package (MCMCpack)
## Copyright (C) 2003-2020 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)
##
[1] "Warning: First Batch Will Be Shorter Than Rest Since Chain Length Is Not a Multiple of Batch Size"
[1] 9
[1] "Warning: First Batch Will Be Shorter Than Rest Since Chain Length Is Not a Multiple of Batch Size"
[1] "Warning: First Batch Will Be Shorter Than Rest Since Chain Length Is Not a Multiple of Batch Size"
[1] 9
[1] "Warning: First Batch Will Be Shorter Than Rest Since Chain Length Is Not a Multiple of Batch Size"
[1] "Warning: First Batch Will Be Shorter Than Rest Since Chain Length Is Not a Multiple of Batch Size"
[1] 9
[1] "Warning: First Batch Will Be Shorter Than Rest Since Chain Length Is Not a Multiple of Batch Size"
[1] "Warning: First Batch Will Be Shorter Than Rest Since Chain Length Is Not a Multiple of Batch Size"
[1] 9
[1] "Warning: First Batch Will Be Shorter Than Rest Since Chain Length Is Not a Multiple of Batch Size"
[1] "Warning: First Batch Will Be Shorter Than Rest Since Chain Length Is Not a Multiple of Batch Size"
[1] 9
[1] "Warning: First Batch Will Be Shorter Than Rest Since Chain Length Is Not a Multiple of Batch Size"
[1] "Warning: First Batch Will Be Shorter Than Rest Since Chain Length Is Not a Multiple of Batch Size"
[1] 9
[1] "Warning: First Batch Will Be Shorter Than Rest Since Chain Length Is Not a Multiple of Batch Size"
[1] "Warning: First Batch Will Be Shorter Than Rest Since Chain Length Is Not a Multiple of Batch Size"
[1] 9
[1] "Warning: First Batch Will Be Shorter Than Rest Since Chain Length Is Not a Multiple of Batch Size"
[1] "Warning: First Batch Will Be Shorter Than Rest Since Chain Length Is Not a Multiple of Batch Size"
[1] 9
[1] "Warning: First Batch Will Be Shorter Than Rest Since Chain Length Is Not a Multiple of Batch Size"
[1] "Warning: First Batch Will Be Shorter Than Rest Since Chain Length Is Not a Multiple of Batch Size"
[1] 9
[1] "Warning: First Batch Will Be Shorter Than Rest Since Chain Length Is Not a Multiple of Batch Size"
[1] "Warning: First Batch Will Be Shorter Than Rest Since Chain Length Is Not a Multiple of Batch Size"
[1] 9
[1] "Warning: First Batch Will Be Shorter Than Rest Since Chain Length Is Not a Multiple of Batch Size"
                               100       200       300       400        500
(Intercept)              0.4871418 0.3361127 0.3458709 0.3806246 0.18596155
SegSumT                  0.6777064 0.3431629 0.4162407 0.4569468 0.26186612
DSDist                   0.4779663 0.6886854 0.2488229 0.3422701 0.33054150
USNative                 0.4116322 0.1805175 0.2480958 0.3884495 0.21862841
as.factor(Method)mixture 0.3233801 0.4240612 0.4900830 0.3743734 0.09215237
as.factor(Method)net     0.4410652 0.3286455 0.6872688 0.2767111 0.29500596
as.factor(Method)spo     0.3876532 0.3640551 0.2825983 0.7213052 0.33970099
as.factor(Method)trap    0.4170663 0.4592381 0.2830349 0.1848514 0.21275535
DSMaxSlope               0.4827681 0.3074304 0.1883176 0.3505506 0.32797264
USSlope                  0.3891263 0.4727947 0.1602418 0.6682311 0.41410256
                               600       700       800       900
(Intercept)              0.3106141 0.2181161 0.5712537 0.2728547
SegSumT                  0.2935824 0.3031936 0.6476434 0.3104614
DSDist                   0.2791571 0.4403813 0.6338070 0.7466952
USNative                 0.3831158 0.2875400 0.5242461 0.4961313
as.factor(Method)mixture 0.1942033 0.1803766 0.3788770 0.2596900
as.factor(Method)net     0.5439513 0.2691177 0.8083021 0.7008379
as.factor(Method)spo     0.4967071 0.3921877 0.6248727 0.2352780
as.factor(Method)trap    0.3124602 0.4975312 0.3475681 0.2313808
DSMaxSlope               0.2144346 0.5783819 0.4833469 0.2760540
USSlope                  0.3237241 0.2579194 0.4547821 0.3260549

bmk documentation built on May 1, 2019, 8:21 p.m.

Related to bmkconverge in bmk...