Yet Another Blog in Statistical Computing

I can calculate the motion of heavenly bodies but not the madness of people. -Isaac Newton

A Distribution-Free Alternative to Vuong Test

The Vuong test has been widely used in nonnested model selection under the normality assumption. While the Vuong test determines whether the average log-likelihood ratio is statistically different from zero, the distribution-free test proposed by Clarke determines whether or not the median log-likelihood ratio is statistically different from zero.

Below is the SAS macro to implement Clarke test.

%macro clarke(data = , ll1 = , q1 = , ll2 = , q2 = );
***********************************************************;
* THE SAS MACRO IS TO PERFORM AN ALTERNATIVE TO VUONG     *;
* TEST, DISTRIBUTION-FREE CLARKE TEST, FOR THE MODEL      *;
* COMPARISON.                                             *;
* ======================================================= *;
* PAMAMETERS:                                             *;
*  DATA: INPUT SAS DATA TABLE                             *;
*  LL1 : LOG LIKELIHOOD FUNCTION OF THE MODEL 1           *;
*  Q1  : DEGREE OF FREEDOM OF THE MODEL 1                 *;
*  LL2 : LOG LIKELIHOOD FUNCTION OF THE MODEL 2           *;
*  Q2  : DEGREE OF FREEDOM OF THE MODEL 2                 *;
* ======================================================= *;
* REFERENCE:                                              *;
*  A SIMPLE DISTRIBUTION-FREE TEST FOR NONNESTED MODEL    *;
*  SELECTION, KEVIN CLARKE, 2007                          *;
* ======================================================= *;
* CONTACT:                                                *;
*  WENSUI.LIU@53.COM                                      *;
***********************************************************;

options mprint mlogic formchar = "|----|+|---+=|-/\<>*" nocenter nonumber nodate;

data _tmp1;
  set &data;
  where &ll1 ~= 0 and &ll2 ~= 0;
run;

proc sql noprint;
  select count(*) into :nobs from _tmp1;
quit;

%let schwarz = %sysevalf((&q1 - &q2) * %sysfunc(log(&nobs)) / &nobs);

data _tmp2;
  set _tmp1;
  z = &ll1 - &ll2 - &schwarz;
  b1 = 0;
  b2 = 0;
  if z > 0 then b1 = 1;
  if z < 0 then b2 = 1;
run;

proc sql;
  create table
    _tmp3 as
  select 
    cdf("binomial", count(*) - sum(b1), 0.5, count(*))             as p1,
    cdf("binomial", count(*) - sum(b2), 0.5, count(*))             as p2,
    min(1, cdf("binomial", count(*) - sum(b2), 0.5, count(*)) * 2) as p3
  from 
    _tmp2;
quit;

proc report data = _tmp3 spacing = 1 split = "*" headline nowindows;
  column("Null Hypothesis: MDL1 = MDL2" p1 p2 p3);
  define p1  / "MDL1 > MDL2"  width = 15 format = 12.8 order;
  define p2  / "MDL1 < MDL2"  width = 15 format = 12.8;
  define p3  / "MDL1 != MDL2" width = 15 format = 12.8;
run;

%mend clarke;
Advertisements

Written by statcompute

September 24, 2012 at 12:49 am

%d bloggers like this: