How to derive the symmetry condition for the stretch move in emcee / affine invariant ensemble MCMC samplers? The emcee library implements the stretch move proposal in line with the paper by Goodman and Weare. More specifically, for two given walkers $X_k$ and $X_i$, the proposal is
$$
X_k \to Y = X_i + Z(X_k - X_i).
$$
Here $Z$ is a 1D random variable with pdf $g(z)$. The paper above then proceeds demanding the proposal be symmetric and concludes without proof that this implies that the pdf satisfies the symmetry condition
$$
g(1/z) = z g(z).
$$
How do we proof this result?
I understand that the inverse proposal is
$$
Y \to X_k = X_i + Z^{-1}(Y - X_i).
$$
Then, demanding symmetry, the random variable $Z^{-1}$ should have the same distribution as $Z$, which would imply that
$$
g(1/z) = z^2 g(z),
$$
see for example here.
Am I missing something?
 A: With the help of the emcee-user mailing group this question got cleared out, see here for the discussion. For future reference, their answer is copied here.
It turns out that both the conditions $g(1/z) = z g(z)$ and $g(1/z) = z^2 g(z)$ are correct if accompanied with a suitable acceptance ratio in the Metropolis-Hastings algorithm. In fact, any condition of the form
$$
g(1/z) = z^m g(z)
$$
can be chosen if we take for the acceptance probability
$$
A(X_k \to Y) = \min\big(1, Z^{m + n - 2} \pi(Y) / \pi(X_k)\big), \tag{1}\label{eq1}
$$
where $Z$ is a 1D random variable with pdf $g(z)$ and $n$ is the dimension of the parameter space. To see this, let the proposal distribution in $X$-space be $P(X_k \to Y)$. Since proposals are governed by the scale factor $Z \sim g(z)$ in the stretch move
$$
X_k \to Y = X_i + Z(X_k−X_i),
$$
the proposal probability to end up in small volume around $Y$ satisfies
$$
P(X_k \to Y) r^{n-1} \,dr \,d\Omega_{n-1} = g(z) dz,
$$
using spherical coordinates centered around $X_i$ and letting $r = z|X_k - X_i|$. Further simplifying this equation gives
$$
P(X_k \to Y) z^{n-1} |X_k - X_i|^n \,d\Omega_{n-1} = g(z).
$$
For the opposite move $Y \to X_k$ one obtains
$$
P(Y \to X_k) z^{-(n-1)} |Y - X_i|^n \,d\Omega_{n-1} = g(1/z).
$$
Lastly, substituting these relations in the Metropolis acceptance ratio
$$
A(X_k \to Y) = \min\bigg(1, \frac{P(Y \to X_k) \pi(Y)}{ P(X_k \to Y) \pi(X_k)}\bigg)
$$
reproduces \eqref{eq1}.
The Goodman and Weare paper chooses $m = 1$, in which case the factor in the acceptance ratio is $Z^{n-1}$. In a 1D parameter space this reduces to one, and the acceptance probability is similar in form to when a symmetric proposal $P(X_k \to Y)$ would be used.
As already pointed out in the question, a choice of $m = 2$ corresponds to a symmetric distribution for $Z$ in the sense that the probabilities for $Z$ and $Z^{-1}$ are the same.
Lastly, the choice $m = 2 - n$ implies that the factor in the acceptance ratio is one in all dimensions, and could also be considered symmetric.
