BookmarkSubscribeRSS Feed
bathbrew
Calcite | Level 5

I am trying to run logistic regression using informative prior assumptions with PROC GENMOD.  I found an example of how to assign prior distributions explicitly for dichotomous variables.  However, the variable I want to use has 4 levels(called VAR below).  I just want my priors to reflect the VAR distributions.  Could someone please help me with naming the variables in the prior dataset? 

Snapshot of data - 

VAR           VARBIG     EVENT

1 to 4         1 to 999      0/1

 

*Input prior distributions;

data Prior;

   input _type_ $ Intercept ???????; *What do I call them to indicate VAR=1, VAR=2...?;

   datalines;

Var 1 1 1 1 

Mean 0 .2 .3 .5

;

 

proc genmod data=model_out;
class VAR (ref='1') VARBIG / param=ref;
model EVENT(event='1') = VAR VARBIG VAR*VARBIG / DIST=bin LINK=logit;
bayes seed=1 coeffprior=normal(input=Prior);

run;

 

Thanks!!!

 

5 REPLIES 5
bathbrew
Calcite | Level 5

Thank you for the quick response.  Does that imply that it just fills in for the first levels and I don't actually need to name the variables?

 

I haven't used the Bayes statement before so I appreciate your patience!

StatDave
SAS Super FREQ

As noted in the documentation of the CPRIOR= option, "Parameter names can be found in any of the tables (such as the "Initial Values of the Chain" table) in the Bayesian Analysis section of the results." 

bathbrew
Calcite | Level 5

Thanks.  Could you please give me an example?  I am new to using the Bayes statement in GENMOD and cannot find an example online where the priors are for a categorical variable with more than 2 levels.

 

H
Pyrite | Level 9 H
Pyrite | Level 9

@bathbrew

 

I see your post was from a year ago and I don't have a direction solution for you. - but though this may help the greater community.

 

What I would try if the naming convention was confusing, would be to run the model with the default flat priors and see how they are getting applied in the output. Then output the posteriors from the model, and see how it is auto-naming the terms in the model in the generated file. I remember being confused when I was just using a binary covariate. Once you have these generated names you may be able to then try to use them when defining your informative priors. While doing this, look at the model output and see that they are getting applied appropriately. Another initially confusing attribute is that precision = 1 / supplied variance value. So you define a certain prior for variance then the output actually displays its inverse as precision.   

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 5 replies
  • 1700 views
  • 0 likes
  • 4 in conversation