Solved
Contributor
Posts: 25

# Specifying half-cauchy (hyper)prior in PROC MCMC

Dear all,

has someone tried to specify a half-cauchy hyperprior in PROC MCMC (I suppose it would likely be the same in any other procedure)?

I am trying to get something like this to work (in order to get a horseshoe shrinkage estimator):
hyperprior lambda ~ halfcauchy(0,1);
hyperprior tau ~ some other distribution;
hyperprior sigma ~ some other distribution;
prior theta ~ normal(0,sd=lambda*tau);
model y ~ normal( theta, sd=sigma);

The standard distributions do not seem to include the half-cauchy, so I tried to get it by specifying
hyperprior lambda ~ cauchy(0,1);
...
prior theta ~ normal(0,sd=abs(lambda)*tau);
...
But if I do that, I get (presumably because the support of lambda includes zero)
ERROR: The NORMAL distribution of beta1 is invalid. It has a nonpositive variance, standard deviation, or precision parameter 0. Use an appropriate parameter value instead.

How do I get something like this to work? If you happen to know the answer, your help would be appreciated.

Many thanks,
Björn

Accepted Solutions
Solution
‎05-02-2013 11:32 AM
SAS Super FREQ
Posts: 3,842

## Re: Specifying half-cauchy (hyper)prior in PROC MCMC

I asked someone smarter than I am about this. He informed me that the initial value for the PROC MCMC simulation is based on the mode of the prior distribution. For the Cauchy, the mode is zero, which leads to the error.

You can either explicitly set an initial value, such as

PARM lambda 1;

or you can move the lower limit of the Cauchy distribution away from zero by using an expression like

lambda ~ cauchy(0, 1, lower=1e-12);

The second choice will bound lambda away from zero, which might be a reasonable thing to do.

All Replies
SAS Super FREQ
Posts: 3,842

## Re: Specifying half-cauchy (hyper)prior in PROC MCMC

It's strange that you encounter the error, since the probability that you would get an exact zero during a run is exceedingly small. Are you sure it isn't tau that is causing the problem?

Contributor
Posts: 25

## Re: Specifying half-cauchy (hyper)prior in PROC MCMC

Thanks for the idea, I tried this with

hyperprior tau ~ igamma(1, scale = 1);

so I would have assumed that is not the issue.

I am not sure whether the error message means that you truly get =0 in a run, or whether it is related to some checking that SAS does regarding whether support of the prior includes 0 (with certain priors getting special handling with a >0 restriction)? I'm purely speculating in this respect as I do not really know how SAS handles that.

Solution
‎05-02-2013 11:32 AM
SAS Super FREQ
Posts: 3,842

## Re: Specifying half-cauchy (hyper)prior in PROC MCMC

I asked someone smarter than I am about this. He informed me that the initial value for the PROC MCMC simulation is based on the mode of the prior distribution. For the Cauchy, the mode is zero, which leads to the error.

You can either explicitly set an initial value, such as

PARM lambda 1;

or you can move the lower limit of the Cauchy distribution away from zero by using an expression like

lambda ~ cauchy(0, 1, lower=1e-12);

The second choice will bound lambda away from zero, which might be a reasonable thing to do.

Contributor
Posts: 25

## Re: Specifying half-cauchy (hyper)prior in PROC MCMC

Thanks a lot, specifying a positive initial value using the PARM statement was indeed the solution!

🔒 This topic is solved and locked.