BookmarkSubscribeRSS Feed
Ajax
Calcite | Level 5

Hi Guys,

 

Im trying to use informative priors in proc genmod. I tried a simple test using this code:

 

proc genmod data= SASHELP.CARS;
class Type Make;
model MSRP= EngineSize Weight WheelBase Length Type Make Cylinders Invoice EngineSize*Make WheelBase*Make / d=normal link=identity ;
bayes seed=1 coeffprior=normal(input=normalprior) outpost=postcars ;

 

ods output postsummaries=POSTSUMMARIES FitStatistics=FitStats;

 

Data set "normalprior" looks like this: 

 

 

  data NormalPrior;
input _type_ $ Intercept Length ;
datalines;
Var 1e6 0.000000001
Mean 0.0 19650
;
run;

 

 

This worked relatively well. I got confidence intervals for each estimate and I could see the priors being used in the  "Initial values of chain" section and the "Independant normal prior for regression coefficients" section. The posterior summaries section also reflects the prior that I gave the model. 

 

When i tried to do the same on a different dataset with many more variables and much more data - It some how does not work. I see the priors in the   "Independant normal prior for regression coefficients" section but DO NOT see the priors I used in the "Initial values of chain" section - This section contains the initial non-prior estimates. As a result - When i check my posterior summaries - the estimate is exactly the same the as normal estimate before the informative prior. Im not sure why this is happening.

 

Any insights will be greatly appreciated. 

 

Thanks

 

 

 

 

 

3 REPLIES 3
ballardw
Super User

When something works for one data set but not another, assuming there were no other options than more variables then one suspects the content of the data is the issue not that the code is "not working".

 

With neither code nor data it is extremely difficult to pinpoint where things may not go as expected.

Ajax
Calcite | Level 5
Is there another way to constraint coefficient to a specific value in proc genmod ?
evardoodle
Fluorite | Level 6

I don't believe that your intitial values should be equal to your prior values, it should be linked to the seed that you set. If you want to set initial values then you can specify INITIALMLE to use the maximimum likelihood estimates, or you can input a datset with initial values using INITIAL=. 

 

I noticed when I tried INITIALMLE, I would get the exact same posterior estimates, even when I changed my priors. I'm not sure why this happened. It could be my data. I also got very different posterior estimates when I used the variances vs. covariances in a prior dataset. 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 3 replies
  • 1947 views
  • 0 likes
  • 3 in conversation