# Does the cauchy/uniform reparametrization extend to the half-cauchy distribution?

The Stan user guide notes that if we want to model a random variable
Y \sim \mathrm{Cauchy}(\mu, \tau),
we can reparametrize this as
U = \mu + \tau \tan{Y} \to U \sim \mathrm{Uniform}\left(-\frac{\pi}{2}, \frac{\pi}{2}\right).

I was wondering if this extends naturally to half-Cauchy random variables, e.g.
Y \sim \text{Half-Cauchy}(\mu, \tau)

can be reparametrized as
U = \mu + \tau \tan{Y} \to U \sim \mathrm{Uniform}\left(0, \frac{\pi}{2}\right).

Would sampling U and then transforming in this way work, or is it better to use the first parametrization and then include a lower bound constraint?

Better for what? Guessing that you are worried of sampling efficiency on thick tail, note thar for lower bound constrained parameters the sampling happens in log space and the tail in that space is less thick than Cauchy.

1 Like

Yes, I have a model with two parameters following Half-Cauchy distributions that have low effective sample size compared to the rest of the parameters. So I wanted to try the reparametrization indicated in the user guide. But the user guide specifically talks about Cauchy RVs instead of half-Cauchy, so I’m not sure about the best way to implement this.

Online Appendix C of Rank-normalization, folding, and localization: An improved RˆR^ for assessing convergence of MCMC illustrates the sampling efficiency in case of a few Cauchy parameterizations and the half-Cauchy with the nominal parameterization. There are no issues with the nominal parameterization in case of half-Cauchy. I guess the low efficiency in your case is due to some other reason.

1 Like

Similar to the Cauchy model one can implement a half-Cauchy model in a variety of ways, but one has to be careful about the positivity constraint and the location parameter. If one takes the location parameter to be zero then

u  ~ uniform(0, 0.5 * pi)
y = tau * tan(u)


is equivalent to

y ~ cauchy(0, tau)


If, however, the location parameter is not zero then one has to be more careful. It helps to recognize that this reparameterization is effectively exploiting the cumulative distribution function. For example if we rewrite the full Cauchy reparameterization slightly as

u ~  uniform(0, 1)
y = mu + tau * tan( pi * (u - 0.5) )


then we can see that u can be interpreted as the cumulative probability at y,

u = \int_{-\infty}^{y} \mathrm{d} y' \text{cauchy}(y' \mid \mu, \tau).

This means that u = 0.5 corresponds to y = mu. To figure out how to what values of u corresponds to y = 0 we need to solve

u = \int_{-\infty}^{0} \mathrm{d} y' \text{cauchy}(y' \mid \mu, \tau).

Fortunately this is straightforward since the quantile function is analytic for the Cauchy family.

Anyways regarding performance these reparameterizations will speed up sampling relative to the nominal parameterization both for the full Cauchy and the half Cauchy. That said keep in mind that effective sample size may not be relevant for these variables since moments don’t exist and a Markov chain Monte Carlo central limit theorem cannot hold. See for example the discussion in Fitting The Cauchy Distribution.

While I’m here, if you have a few variables with Cauchy tails because of a half Cauchy prior model I would strongly recommend reconsidering that prior model. The Cauchy tail is so heavy that typically allows of model configurations far beyond those compatible with domain expertise. I discuss this a bit in Section 3.2 of Prior Modeling.

EDIT: @maxbiostat edited this post for latex syntax highlighting.

4 Likes

Awesome response, thank you!

1 Like