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.