BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
BjoernHolzhauer
Obsidian | Level 7

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

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

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.

View solution in original post

4 REPLIES 4
Rick_SAS
SAS Super FREQ

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?

BjoernHolzhauer
Obsidian | Level 7

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.

Rick_SAS
SAS Super FREQ

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.

BjoernHolzhauer
Obsidian | Level 7

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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 2383 views
  • 3 likes
  • 2 in conversation