The Kolmogorov-Smirnov test is a nonparametric test of stationarity
that has been applied as an MCMC diagnostic (Brooks et al, 2003), such
as to the posterior samples from the
function. The first and last halves of the chain are compared. This
test assumes IID, which is violated in the presence of
KS.Diagnostic is a univariate diagnostic that is usually
applied to each marginal posterior distribution. A multivariate form
is not included. By chance alone due to multiple independent tests,
5% of the marginal posterior distributions should appear
non-stationary when stationarity exists. Assessing multivariate
convergence is difficult.
This is a vector of posterior samples for which a Kolmogorov-Smirnov test will be applied that compares the first and last halves for stationarity.
There are two main approaches to using the Kolmogorov-Smirnov test as
an MCMC diagnostic. There is a version of the test that has
been adapted to account for autocorrelation (and is not included
here). Otherwise, the chain is thinned enough that autocorrelation is
not present or is minimized, in which case the two-sample
Kolmogorov-Smirnov test is applied. The CDFs of both samples are
ks.test function in base R is used.
The advantage of the Kolmogorov-Smirnov test is that it is easier and faster to calculate. The disadvantages are that autocorrelation biases results, and the test is generally biased on the conservative side (indicating stationarity when it should not).
KS.Diagnostic function returns a frequentist p-value, and
stationarity is indicated when p > 0.05.
Statisticat, LLC. firstname.lastname@example.org
Brooks, S.P., Giudici, P., and Philippe, A. (2003). "Nonparametric Convergence Assessment for MCMC Model Selection". Journal of Computational and Graphical Statistics. 12(1), p. 1–22.
1 2 3
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.