## Bayes vs. SAS

**G**lancing perchance at the back of my * Amstat* News, I was intrigued by the

**SAS**advertisement

Bayesian Methods

Specify Bayesian analysis for ANOVA, logistic regression, Poisson regression, accelerated failure time models and Cox regression through the GENMOD, LIFEREG and PHREG procedures.

Analyze a wider variety of models with the MCMC procedure, a general purpose Bayesian analysis procedure.

and so decided to take a look at those items on the **SAS** website. (Some entries date back to 2006 so I am not claiming novelty in this post, just my reading through the manual!)

**E**ven though I have not looked at a **SAS** program since the time in 1984 I was learning principal component and discriminant analysis by programming **SAS** procedures on punched cards, it seems the MCMC part is rather manageable (if you can manage **SAS** at all!), looking very much like a second BUGS to my bystander eyes, even to the point of including ARS algorithms! The models are defined in a BUGS manner, with priors on the side (and this includes improper priors, despite a confusing first example that mixes very large variances with vague priors for the linear model!). The basic scheme is a random walk proposal with adaptive scale or covariance matrix. (The adaptivity on the covariance matrix is slightly confusing in that the way it is described it does not seem to implement the requirements of Roberts and Rosenthal for sure convergence.) Gibbs sampling is not directly covered, although some examples are in essence using Gibbs samplers. Convergence is assessed via ca. 1995 methods à la Cowles and Carlin, including the rather unreliable Raftery and Lewis indicator, but so does ** Introducing Monte Carlo Methods with R**, which takes advantage of the R

*coda*package. I have not tested (!) any of the features in the MCMC procedure but judging from a quick skim through the 283 page manual everything looks reasonable enough. I wonder if anyone has ever tested a SAS program against its BUGS counterpart for efficiency comparison.

**T**he Bayesian aspects are rather traditional as well, except for the testing issue. Indeed, from what I have read, **SAS** does not engage into testing and remains within estimation bounds, offering only HPD regions for variable selection without producing a genuine Bayesian model choice tool. I understand the issues with handling improper priors versus computing Bayes factors, as well as some delicate computational requirements, but this is a truly important chunk missing from the package. (Of course, the package contains a DIC (Deviance information criterion) capability, which may be seen as a substitute, but I have reservations about the relevance of DIC outside generalised linear models. Same difficulty with the posterior predictive.) As usual with SAS, the documentation is huge (I still remember the shelves after shelves of documentation volumes in my 1984 card-punching room!) and full of options and examples. Nothing to complain about. Except maybe the list of *disadvantages in using Bayesian analysis:*

*It does not tell you how to select a prior. There is no correct way to choose a prior. Bayesian inferences require skills to translate prior beliefs into a mathematically formulated prior. If you do not proceed with caution, you can generate misleading results.**It can produce posterior distributions that are heavily influenced by the priors. From a practical point of view, it might sometimes be difficult to convince subject matter experts who do not agree with the validity of the chosen prior.**It often comes with a high computational cost, especially in models with a large number of parameters.*

which does not say much… Since the MCMC procedure allows for any degree of hierarchical modelling, it is always possible to check the impact of a given prior by letting its parameters go random. I found that most practitioners are happy with the formalisation of their prior beliefs into mathematical densities, rather than adamant about a specific prior. As for computation, this is not a major issue.

June 15, 2010 at 4:40 pm

I do not think the SAS Bayes stuff uses the BUGS software. It might be

interesting to write an interface between SAS and BUGS (better OpenBUGS). Can SAS call other (Windows) programs?

May 9, 2010 at 6:30 pm

…looking very much like a second BUGS… I thought the exact same thing when I first saw PROC MCMC and its ouput. Even the plots look similar to WinBUGS plots!

…I wonder if anyone has ever tested a SAS program against its BUGS counterpart for efficiency comparison… Though I suppose there is no way to know, except maybe with some disassembly, I wonder if the SAS program shares some identical code with WinBUGS/JAGS.

…It can produce posterior distributions that are heavily influenced by the priors… Of course it can, when the likelihood is not well identified! I find this is an advantage of the Bayesian method, rather than a disadvantage.

May 9, 2010 at 6:37 pm

SAS being NOT an open-source software, we will never know! As for the criticisms of Bayesian analysis, I did copy them with a sarcastic intent, believe me!!!

May 7, 2010 at 11:26 am

From the documentation you quoted: “here is no correct way to choose a prior. Bayesian inferences require skills to translate prior beliefs into a mathematically formulated prior. If you do not proceed with caution, you can generate misleading results. . . . From a practical point of view, it might sometimes be difficult to convince subject matter experts who do not agree with the validity of the chosen prior.”

That is so tacky! As if least squares, logistic regressions, Cox models, and all those other likelihoods are so automatically convincing.