Clinician's
corner

Back to main page

Programmer's
corner
So, you use WinBUGS a lot? Want more?
Patrick Blisle
Division of Clinical Epidemiology
McGill University Health Center
Montreal, Quebec CANADA
patrick.belisle@rimuhc.ca

Last modification: 24 sep 2015















Version 1.1 (July 2011)
SAS macro %BICOrdinalLogistic
Computing the BIC (Bayesian Information Criterion) in Ordinal Logistic Regression Models
Model selection for (dichotomous) logistic regession models is made easy in R through the use of Chris Volinsky's bic.glm function. However, this function does not accommodate ordinal outcomes. When the outcome variable is ordinal, there is to my knowledge no R or SAS function or macro available, hence the need for %BICOrdinalLogistic.

[ %BICOrdinalLogistic is a SAS macro for computing Bayesian Information Criterion (BIC) in Ordinal Logistic Regression Models. ]


Unlike the BIC functions available for R which use Occam's Razor to pare down the total number of models reported, %BICOrdinalLogistic fits every possible model (i.e., 2p models for p covariates) derived from the list of independent variables (see indep in argument's list below). This means that %BICOrdinalLogistic may run for a long time — or may even crash — when the number of independent variables is large.

%BICOrdinalLogistic is a SAS macro included in the downloadable file that reports %BICOrdinalLogistic output in a reader-friendly fashion. See example below for an illustration of combined use of these two macros.

Menu




Top
Syntax

%BICOrdinalLogistic(outModels=, outParms=, data=, outcome=, indep=, force=, level=0.95);


Top
%BICOrdinalLogistic arguments list

Argument Value
outModels Name of output dataset where the list of compared models will be saved.
outParms Name of output dataset where each model's parameter estimates will be saved.
data Name of the data set to be analyzed.
outcome Name of the outcome variable.
indep List of independent variables.
String variables and formatted variables (variables with value labels) are analyzed as class variables.
force An optional list of independent variables to be forced in the model (models without any of the variables listed will be discarded).
level Level of Odds Ratio Credible Intervals reported.


Top
Example

Consider the problem where the 5-category outcome variable Y is modeled through a series of four candidate variables, namely alpha, beta, gamma and delta, stored in data set myData. BIC model selection is run through the SAS macro call:

%BICOrdinalLogistic(outModels=bicModels, outParms=bicParms, data=myData, outcome=Y, indep=alpha beta gamma delta);


where the arguments bicModels and bicParms are output data sets, which can be printed, used or modified if necessary:

proc print data=bicModels; run;

                                                                                    Is
                                                                minus2log          Null
       Obs    Model                     Converged      BIC          L        p     Model

         1    NULL                          1        3948.58     3919.88     4       1
         2    delta                         1        3893.04     3857.16     5       0
         3    gamma                         1        3949.17     3913.29     5       0
         4    gamma,delta                   1        3892.68     3849.62     6       0
         5    beta                          1        3940.16     3904.28     5       0
         6    beta,delta                    1        3875.62     3832.57     6       0
         7    beta,gamma                    1        3943.49     3900.43     6       0
         8    beta,gamma,delta              1        3878.82     3828.59     7       0
         9    alpha                         1        3946.89     3911.01     5       0
        10    alpha,delta                   1        3899.33     3856.28     6       0
        11    alpha,gamma                   1        3946.39     3903.33     6       0
        12    alpha,gamma,delta             1        3899.27     3849.03     7       0
        13    alpha,beta                    1        3936.14     3893.08     6       0
        14    alpha,beta,delta              1        3882.19     3831.95     7       0
        15    alpha,beta,gamma              1        3938.71     3888.48     7       0
        16    alpha,beta,gamma,delta        1        3885.56     3828.15     8       0

Note that while running, %BICOrdinalLogistic prints proc logistic output (for each of the 16 models) to Sas output window: however, every relevant piece of information for the computation of BIC values is stored in the output data sets, and the output window can thus be ignored.

The sas macro %BICOrdinalLogistic (included in the downloadable file below) conveniently produces a comprehensive HTML version of the BIC output.

ods listing close;
ods html file="c:\users\pbelisle\My Documents\Home\MyProject\log\BICOrdinalLogistic.html" style=mystyle;
title 'BIC (Bayesian Information Criterion) results';

%BICOrdinalLogisticReport(parms=bicParms, models=bicModels);

ods html close;
title;
ods listing;


which should look like this:

Click on the above image to view the actual Html output file.


Note that only 3 (of the 16 possible models) were included in the report, since by default only the models with probability ≥ 1% are printed; to include all models in the report, call %BICOrdinalLogistic with the inclusive option where= (left empty), as in:

%BICOrdinalLogisticReport(parms=bicParms, models=bicModels, where=);


Top
Interaction terms

Interaction terms of order 2 are allowed in the model. Class variables, however, are not allowed to have interaction terms in the actual version.

%BICOrdinalLogistic(outModels=bicModels, outParms=bicParms, data=myData, outcome=Y, indep=alpha beta gamma delta alpha*gamma);




Top
Download

%BICOrdinalLogistic is a free SAS macro. Download version 1.1 now.