Testing for Homoscedasticity of the Utility Function

/*--------------------------------------------------------------

                    SAS Sample Library

        Name: mdcex04.sas
 Description: Example program from SAS/ETS User's Guide,
              The MDC Procedure
       Title: Testing for Homoscedasticity of the Utility Function
     Product: SAS/ETS Software
        Keys: multinomial discrete choice
        PROC: MDC
       Notes:

--------------------------------------------------------------*/

data origdata;
   input ttime1 ttime2 ttime3 choice @@;
datalines;
16.481  16.196  23.89   2  15.123  11.373  14.182  2
19.469  8.822   20.819  2  18.847  15.649  21.28   2
12.578  10.671  18.335  2  11.513  20.582  27.838  1
10.651  15.537  17.418  1  8.359   15.675  21.05   1
11.679  12.668  23.104  1  23.237  10.356  21.346  2
13.236  16.019  10.087  3  20.052  16.861  14.168  3
18.917  14.764  21.564  2  18.2    6.868   19.095  2
10.777  16.554  15.938  1  20.003  6.377   9.314   2
19.768  8.523   18.96   2  8.151   13.845  17.643  2
22.173  18.045  15.535  1  13.134  11.067  19.108  2
14.051  14.247  15.764  1  14.685  10.811  12.361  3
11.666  10.758  16.445  1  17.211  15.201  17.059  3
13.93   16.227  22.024  1  15.237  14.345  19.984  2
10.84   11.071  10.188  1  16.841  11.224  13.417  2
13.913  16.991  26.618  3  13.089  9.822   19.162  2
16.626  10.725  15.285  3  13.477  15.509  24.421  2
20.851  14.557  19.8    2  11.365  12.673  22.212  2
13.296  10.076  17.81   2  15.417  14.103  21.05   1
15.938  11.18   19.851  2  19.034  14.125  19.764  2
10.466  12.841  18.54   1  15.799  16.979  13.074  3
12.713  15.105  13.629  2  16.908  10.958  19.713  2
17.098  6.853   14.502  2  18.608  14.286  18.301  2
11.059  10.812  20.121  1  15.641  10.754  24.669  2
7.822   18.949  16.904  1  12.824  5.697   19.183  2
11.852  12.147  15.672  2  15.557  8.307   22.286  2
;

data newdata(keep=pid decision mode ttime);
   set origdata;
   array tvec{3} ttime1 - ttime3;
   retain pid 0;
   pid + 1;
   do i = 1 to 3;
      mode = i;
      ttime = tvec{i};
      decision = ( choice = i );
      output;
   end;
run;

/*-- HEV Estimation --*/
proc mdc data=newdata;
   model decision = ttime /
            type=hev
            nchoice=3
            hev=(unitscale=1 2 3, integrate=laguerre)
            covest=hess;
   id pid;
run;

data _null_;
   /*-- test for H0: scale2 = scale3 = 1 --*/
   /*  ln L(max) = -34.1276                */
   /*  ln L(0)   = -33.4138                */
   stat = -2 * ( - 34.1276 + 33.4138 );
   df = 2;
   p_value = 1 - probchi(stat, df);
   put stat= p_value=;
run;

/*-- Heteroscedastic Multinomial Probit --*/
proc mdc data=newdata;
   model decision = ttime /
            type=mprobit
            nchoice=3
            unitvariance=(1 2)
            covest=hess;
   id pid;
   restrict RHO_31 = 0;
run;

/*-- Homoscedastic Multinomial Probit --*/
proc mdc data=newdata;
   model decision = ttime /
             type=mprobit
             nchoice=3
             unitvariance=(1 2 3)
             covest=hess;
   id pid;
   restrict RHO_21 = 0;
run;

data _null_;
   /*-- test for H0: sigma3 = 1 --*/
   /*   ln L(max) = -33.8860      */
   /*   ln L(0)   = -34.5425      */
   stat = -2 * ( -34.5425 + 33.8860 );
   df = 1;
   p_value = 1 - probchi(stat, df);
   put stat= p_value=;
run;