4
votes

I want to perform the standard likelihood ratio test in logsitic regression using SAS. I will have a full logistic model, containing all variables, named A and a nested logistic model B, which is derived by dropping out one variable from A.

If I want to test whether that drop out variable is significant or not, I shall perform a likelihood ratio test of model A and B. Is there an easy way to perform this test (essentially a chi-square test) in SAS using a PROC? Thank you very much for the help.

3

3 Answers

3
votes

If you want to perform likelihood ratio tests that are full model v.s. one variable dropped model, you can use the GENMOD procedure with the type3 option.

Script:

data d1;
do z = 0 to 2;
do y = 0 to 1;
do x = 0 to 1;
  input n @@;
  output;
end; end; end;
cards;
100 200 300 400
50 100 150 200
50 100 150 200
;
proc genmod data = d1;
  class y z;
  freq n;
  model x = y z / error = bin link = logit type3;
run;

Output:

     LR Statistics For Type 3 Analysis

                          Chi-
Source           DF     Square    Pr > ChiSq

y                 1      16.09        <.0001
z                 2       0.00        1.0000
1
votes

I'm no expert on logistic regression, but I think what you are trying to accomplish can be done with PROC LOGISTIC, using the "SELECTION=SCORE" option on the MODEL statement. There are other SELECTION options available, such as STEPWISE, but I think SCORE matches closest to what you are looking for. I would suggest reading up on it though, because there are some associated options (BEST=, START= STOP=) that you might benefit from too.

1
votes

I'm not sure about a PROC statement that can specifically perform LRT but you can compute the test for nested models.

Script

proc logistic data = full_model;
model dependent_var = independent_var(s);
ods output GlobalTests = GlobalTests_full;
run;

data _null_;
set GlobalTests_full;
if test = "Likelihood Ratio" then do;
   call symput("ChiSq_full", ChiSq);
   call symput("DF_full", DF);
   end;
run;

proc logistic data = reduced_model;
model dependent_var = independent_var(s);
ods output GlobalTests = GlobalTests_reduced;
run;

data _null_;
set GlobalTests_reduced;
if test = "Likelihood Ratio" then do;
   call symput("ChiSq_reduced", ChiSq);
   call symput("DF_reduced", DF);
   end;
run;

data LRT_result;
LR = &ChiSq_full - &ChiSq_reduced;
DF = &DF_full - &DF_reduced;
p = 1 - probchi(ChiSq,DF);
run;