BookmarkSubscribeRSS Feed
ChristinaMa96
Calcite | Level 5

Hi! I am comparing two models by the likelihood ratio test and follow the instruction here:https://support.sas.com/kb/24/474.html and I found a script here for the proc logisitic

 

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;

I just wondered how to turn this in proc surveylogistic because I find that the degree of freedom is different. I cannot get the DF by this script since in proc survey logistic, the globaltest has a denominator DF and a numerator DF. But according to the SAS document, 

The LRT statistic has an approximate chi-square distribution with degrees of freedom equal to the difference in the number of parameters between the full and reduced models.

Besides, the numerator DF was corrected by the Rao-Scott test in proc surveylogistic and is different from the difference in the number of parameters.

Which DF is the DF for the likelihood ratio test? Is there any smart way to compare models in proc surveylogistic?

 

Thank you!

 

3 REPLIES 3
SAS_Rob
SAS Employee

If you add the DF=INFINITY option to the MODEL statement in Proc SURVEYLOGISTIC then the Global tests, including the LRT, will be tested using a Chi-Square distribution.  You could then use a similar approach to your example to compute an overall LRT for the full versus reduced model.

ChristinaMa96
Calcite | Level 5

Thank you for your reply. I still have a question. When should I use DF=INFINITY in the model? Although the numerator DF is the same as the DF that I got after using the DF=INFINITY, I found the result for the OR is totally different. I know that when the df is approaching infinity, the F distribution is approaching the chi-square distribution. But I don't know when I should specify and how to apply this option.

SAS_Rob
SAS Employee

For large denominator degrees of freedom you would want to use DF=INFINITY.  In your case, since you want to calculate LRTs I think it would be necessary to use it as well.

SAS Innovate 2025: Register Today!

 

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1212 views
  • 0 likes
  • 2 in conversation