UCLA Academic Technology Services HomeServicesClassesContactJobs
Search

SAS FAQ 
How do I do a conditional logit model analysis in SAS?

SAS 8.2 release of  MDC procedure analyzes conditional logit models. 

Example 1: 1-1 Matching

This example is adapted from Chapter 7 of Applied Logistic Regression by Hosmer & Lemeshow (2000). You can download the SAS data file lbwt11.sas7bdat here.

The first 20 observations are listed below. Notice that variable pairid indicates that the observations are paired.

pairid    lbwt    age    lastwt    race    smoke    ptd    ht    ui    race1    race2    race3
   1        0      14      135       1       0       0      0     0      1        0        0
   1        1      14      101       3       1       1      0     0      0        0        1
   2        0      15       98       2       0       0      0     0      0        1        0
   2        1      15      115       3       0       0      0     1      0        0        1
   3        0      16       95       3       0       0      0     0      0        0        1
   3        1      16      130       3       0       0      0     0      0        0        1
   4        0      17      103       3       0       0      0     0      0        0        1
   4        1      17      130       3       1       1      0     1      0        0        1
   5        0      17      122       1       1       0      0     0      1        0        0
   5        1      17      110       1       1       0      0     0      1        0        0
   6        0      17      113       2       0       0      0     0      0        1        0
   6        1      17      120       1       1       0      0     0      1        0        0
   7        0      17      113       2       0       0      0     0      0        1        0
   7        1      17      120       2       0       0      0     0      0        1        0
   8        0      17      119       3       0       0      0     0      0        0        1
   8        1      17      142       2       0       0      1     0      0        1        0
   9        0      18      100       1       1       0      0     0      1        0        0
   9        1      18      148       3       0       0      0     0      0        0        1
  10        0      18       90       1       1       0      0     1      1        0        0
  10        1      18      110       2       1       1      0     0      0        1        0
proc mdc data = lbwt11;
  model lbwt = lastwt smoke race2 race3 ptd ht ui / type = clogit nchoice = 2;
  id pairid;
run;
The MDC Procedure
Conditional Logit Estimates
Model Fit Summary
Dependent Variable                     lbwt
Number of Observations                   56
Number of Cases                         112
Log Likelihood                    -25.79427
Maximum Absolute Gradient        2.30684E-6
Number of Iterations                      5
Optimization Method          Newton-Raphson
AIC                                65.58854
Schwarz Criterion                  79.76600
       Discrete Response Profile
Index    CHOICE     Frequency    Percent
  0           1             0       0.00
  1           2            56     100.00
Goodness-of-Fit Measures for Discrete Choice Models
Measure                       Value    Formula
Likelihood Ratio (R)         26.044    2 * (LogL - LogL0)
Upper Bound of R (U)         77.632    - 2 * LogL0
Aldrich-Nelson               0.3174    R / (R+N)
Cragg-Uhler 1                0.3719    1 - exp(-R/N)
Cragg-Uhler 2                0.4959    (1-exp(-R/N)) / (1-exp(-U/N))
Estrella                     0.4325    1 - (1-R/U)^(U/N)
Adjusted Estrella            0.2084    1 - ((LogL-K)/LogL0)^(-2/N*LogL0)
McFadden's LRI               0.3355    R / U
N = # of observations, K = # of regressors

           Goodness-of-Fit Measures for Discrete Choice Models
Measure                       Value    Formula
Veall-Zimmermann             0.5464    (R * (U+N)) / (U * (R+N))
N = # of observations, K = # of regressors
                              Parameter Estimates
                                    Standard                 Approx
Parameter       DF     Estimate        Error    t Value    Pr > |t|    Gradient
lastwt           1      -0.0184       0.0101      -1.82      0.0683    -2.31E-6
smoke            1       1.4007       0.6278       2.23      0.0257    3.741E-8
race2            1       0.5714       0.6896       0.83      0.4074    8.89E-10
race3            1      -0.0253       0.6992      -0.04      0.9711    -2.35E-9
ptd              1       1.8080       0.7887       2.29      0.0219    4.792E-8
ht               1       2.3612       1.0861       2.17      0.0297      1.5E-8
ui               1       1.4019       0.6962       2.01      0.0440     1.25E-8

Example 2: 1-M matching

This example is adapted from Chapter 7 of Applied Logistic Regression by Hosmer & Lemeshow (2000). You can download the SAS data file bbdm13.sas7bdat here.

The first 20 observations are listed below. Notice that variable str indicates that there are four choices for each subject.

str    obs    fndx    chk    agmn     wt    mod    wid    nvmr
 1      1       1      1      13     118     55     0       0
 1      2       0      2      11     175      1     0       0
 1      3       0      2      12     135      1     0       0
 1      4       0      1      11     125     55     0       0
 2      1       1      1      14     118     55     0       0
 2      2       0      2      15     183     55     0       0
 2      3       0      2      11     218     55     0       0
 2      4       0      1      13     192     55     0       0
 3      1       1      1      15     125     55     0       0
 3      2       0      2      14     123     55     0       0
 3      3       0      1      13     140     55     0       0
 3      4       0      1      13     160     55     0       0
 4      1       1      1      14     150     55     0       1
 4      2       0      1      13     130      1     0       0
 4      3       0      2      14     140     55     0       0
 4      4       0      1      16     130     55     0       0
 5      1       1      1      17     150      1     0       0
 5      2       0      2      12     148     55     0       0
 5      3       0      1      13     134     55     0       0
 5      4       0      1      14     138     55     1       0
proc mdc data = in.bbdm13;
  model fndx = chk agmn wt mod wid nvmr / type = clogit nchoice = 4;
  id str;
run;
The MDC Procedure
Conditional Logit Estimates
Model Fit Summary
Dependent Variable                     fndx
Number of Observations                   50
Number of Cases                         200
Log Likelihood                    -45.21482
Maximum Absolute Gradient        2.36768E-6
Number of Iterations                      5
Optimization Method          Newton-Raphson
AIC                               102.42965
Schwarz Criterion                 113.90179
       Discrete Response Profile
Index    CHOICE     Frequency    Percent
  0           1            50     100.00
  1           2             0       0.00
  2           3             0       0.00
  3           4             0       0.00
           Goodness-of-Fit Measures for Discrete Choice Models
Measure                       Value    Formula
Likelihood Ratio (R)         48.200    2 * (LogL - LogL0)
Upper Bound of R (U)         138.63    - 2 * LogL0
Aldrich-Nelson               0.4908    R / (R+N)
Cragg-Uhler 1                0.6186    1 - exp(-R/N)
Cragg-Uhler 2                0.6599    (1-exp(-R/N)) / (1-exp(-U/N))
Estrella                     0.6941    1 - (1-R/U)^(U/N)
N = # of observations, K = # of regressors
The MDC Procedure
           Goodness-of-Fit Measures for Discrete Choice Models
Measure                       Value    Formula
Adjusted Estrella            0.5679    1 - ((LogL-K)/LogL0)^(-2/N*LogL0)
McFadden's LRI               0.3477    R / U
Veall-Zimmermann             0.6679    (R * (U+N)) / (U * (R+N))
N = # of observations, K = # of regressors
                              Parameter Estimates
                                    Standard                 Approx
Parameter       DF     Estimate        Error    t Value    Pr > |t|    Gradient
chk              1      -1.1218       0.4474      -2.51      0.0122     -2.2E-8
agmn             1       0.3561       0.1292       2.76      0.0058    8.004E-8
wt               1      -0.0284     0.009978      -2.84      0.0045    -2.37E-6
mod              1     0.003760       0.0120       0.31      0.7538    1.802E-7
wid              1      -0.4916       0.8173      -0.60      0.5475    -1.21E-9
nvmr             1       1.4722       0.7582       1.94      0.0522     7.31E-9

How to cite this page

Report an error on this page

UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services


The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California