Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Red-Portal/MCMCTesting.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
Red-Portal committed Dec 6, 2023
2 parents 65fc874 + c140d09 commit a8930e4
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Ray Kim <[email protected]> and contributors
Copyright (c) 2023 Kyurae Kim <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
[![Build Status](https://github.com/Red-Portal/MCMCTesting.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/Red-Portal/MCMCTesting.jl/actions/workflows/CI.yml?query=branch%3Amain)
[![Coverage](https://codecov.io/gh/Red-Portal/MCMCTesting.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/Red-Portal/MCMCTesting.jl)

This package provides exactness tests for MCMC algorithms as described by Gandy and Scott (2020).
This package provides exactness tests for MCMC algorithms proposed by Gandy and Scott[^GS2020].

## References
* Gandy, Axel, and James Scott. "Unit testing for MCMC and other Monte Carlo methods." arXiv preprint arXiv:2001.06465 (2020).
[^GS2020]: Gandy, Axel, and James Scott. "Unit testing for MCMC and other Monte Carlo methods." arXiv preprint arXiv:2001.06465 (2020).

4 changes: 2 additions & 2 deletions docs/src/exactranktest.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
The exact rank hypothesis testing strategy is based on Algorithm 2 by Gandy & Scott (2021)[^GS2021].

## `ExactRankTest`
The ranks are computed by simulating a single Markov chain backwards and forward.
The ranks are computed by simulating a single Markov chain backward and forward.
First, a random midpoint is simulated as
```math
\begin{aligned}
Expand All @@ -25,7 +25,7 @@ forming the chain
\theta_1,\; \ldots, \; \theta_{M},\; \ldots, \; \theta_{L}.
```
The *rank* is the ranking of the statistics of $\theta_{M}$.
If the sampler and the model are correct, the rank has an uniform distribution as long as the midpoint is independently sampled.
If the sampler and the model are correct, the rank is uniformly distributed as long as the midpoint is independently sampled.

```@docs
ExactRankTest
Expand Down
4 changes: 2 additions & 2 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Documentation for [MCMCTesting](https://github.com/Red-Portal/MCMCTesting.jl).
`MCMCTesting` provides the MCMC testing algorithms developed by Gandy & Scott (2021)[^GS2021].
These tests can be seen as an improvement of the hypothesis testing approach proposed by Geweke [^G2004].
Unlike simulation-based calibration (SBC; [^TBSVG2018][^YD2023][^MMKBPBHFGV2022]), these tests are more appropriate for testing the exactness of the MCMC algorithm rather than the identifiability of the models.
This is because the tests focus on maximizing the power for verify the validity of *individual Markov transitions* instead of a *set of samples*.
Furthermore, unlike SBC, the approach of Gandy & Scott[^GS2021] is able to exactly satisfy the assumptions required for the theoretical guarantees.
This is because the tests focus on maximizing the power of verifying the validity of *individual Markov transitions* instead of a *set of samples*.
Furthermore, unlike SBC, the approach of Gandy & Scott[^GS2021] can exactly satisfy the assumptions required for the theoretical guarantees.


## References
Expand Down
15 changes: 14 additions & 1 deletion src/exactranktest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,20 @@ This test requires the following functions for `model` and `kernel` to be implem
- `sample_joint`
Furthermore, this test explicitly assumes the following
- `kernel` is reversible.
Applying this tests to an irreversible `kernel` will result in false negatives even if its stationary distribution is correct.
For reference, the following kernels are reversible:
- Any Metropolis-Hastings kernel
- slice samplers
- Hamiltonian Monte Carlo/No-U-Turn Samplers with resampling over the trajectory
- random-scan/permutation-scan Gibbs samplers
- Unadjusted Langevin
However, the following kernels are not reversible:
- Hamiltonian Monte Carlo with persistent momentum (a.k.a Horowitz's method, generalized Hamiltonian Monte Carlo)
- Systematic-scan Gibbs samplers
- Piecewise deterministic Markov processes
!!! info
Applying this test to an irreversible `kernel` will result in false negatives even if its stationary distribution is correct.
# Keyword Arguments for Tests
When calling `mcmctest` or `seqmcmctest`, this tests has an additional keyword argument:
Expand Down

2 comments on commit a8930e4

@Red-Portal
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register

Release notes:

  • Loosened the compat bound for StatsBase to improve compatibility with MCMCDiagnosticTools.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/96579

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.3.3 -m "<description of version>" a8930e46365387ff0c3f4ed9ab15a78b7f79b68a
git push origin v0.3.3

Please sign in to comment.