mcmc_potential_scale_reduction {tfprobability}R Documentation

Gelman and Rubin (1992)'s potential scale reduction for chain convergence.

Description

Given N > 1 states from each of C > 1 independent chains, the potential scale reduction factor, commonly referred to as R-hat, measures convergence of the chains (to the same target) by testing for equality of means.

Usage

mcmc_potential_scale_reduction(
  chains_states,
  independent_chain_ndims = 1,
  name = NULL
)

Arguments

chains_states

Tensor or list of Tensors representing the state(s) of a Markov Chain at each result step. The ith state is assumed to have shape ⁠[Ni, Ci1, Ci2,...,CiD] + A⁠. Dimension 0 indexes the Ni > 1 result steps of the Markov Chain. Dimensions 1 through D index the ⁠Ci1 x ... x CiD⁠ independent chains to be tested for convergence to the same target. The remaining dimensions, A, can have any shape (even empty).

independent_chain_ndims

Integer type Tensor with value ⁠>= 1⁠ giving the number of giving the number of dimensions, from dim = 1 to dim = D, holding independent chain results to be tested for convergence.

name

name to prepend to created tf. Default: potential_scale_reduction.

Details

Specifically, R-hat measures the degree to which variance (of the means) between chains exceeds what one would expect if the chains were identically distributed. See Gelman and Rubin (1992), Brooks and Gelman (1998)].

Some guidelines:

To see why R-hat is reasonable, let X be a random variable drawn uniformly from the combined states (combined over all chains). Then, in the limit ⁠N, C --> infinity⁠, with E, Var denoting expectation and variance, ⁠R-hat = ( E[Var[X | chain]] + Var[E[X | chain]] ) / E[Var[X | chain]].⁠ Using the law of total variance, the numerator is the variance of the combined states, and the denominator is the total variance minus the variance of the the individual chain means. If the chains are all drawing from the same distribution, they will have the same mean, and thus the ratio should be one.

Value

Tensor or list of Tensors representing the R-hat statistic for the state(s). Same dtype as state, and shape equal to ⁠state$shape[1 + independent_chain_ndims:]⁠.

References

See Also

Other mcmc_functions: mcmc_effective_sample_size(), mcmc_sample_annealed_importance_chain(), mcmc_sample_chain(), mcmc_sample_halton_sequence()


[Package tfprobability version 0.15.1 Index]