# Question

What is the correct way to specify “half” distributions (e.g. half-cauchy) as a prior, including when a parameters are assigned hierarchical priors?

# Context

I ask because it’s not clear from these posts whether the explicit truncation is required (or only omitted because of a use case) yet I often see others only using the parameter constraints but then using e.g. cross-validation without the truncation. I’m not sure if this is because they (don’t) know better or it’s user error.

- Half-normal, Half-Cauchy and Half-t - #3 by Stephen_Martin
- Declaring constrained parameters - #8 by bhomass

My current understanding is that one should (1) constrain the parameters block and (2) explicitly truncate the distribution in the model block, as shown below:

```
parameters{
real<lower=0> sigma; // constrained
}
model{
y ~ normal(0, sigma)
sigma ~ cauchy(0, 1)[0, ] // truncated
}
```

However, I’m not sure when it comes to hierarchical priors.

For example, is it correct to say the prior below on \sigma is HalfCauchy(0,\phi) where \phi \sim HalfCauchy(0, 1)? Or should I remove some of the truncation/constraints? Not clear if any transforms are required.

```
parameters{
real<lower=0> sigma; // constrained
real<lower=0> phi; // constrained
}
model{
y ~ normal(4, sigma)
sigma ~ cauchy(0, phi)[0, ] // truncated
phi ~ cauchy(0, 1)[0, ] // truncated
}
```