Hi,
I hope to find an answer here, so I have a model like this
Proc GLM data=data;
model loghormone= var1 covariates;
run; (->reduced model)
and I would like to get the interaction term of var1*var2,
Proc GLM data=data;
model loghormone= var1 var2 var1*var2 covariates;
run; (->full model)
however I have no idea which fit statistic I need for the likelihood ratio as there is nothing like that in proc GLM so I tried with proc GENMOD and proc PHREG, however, I don't think that was correct.
I appreciate any help, thank you!
This can be done with the CONTRAST statement in PROC GENMOD as discussed and illustrated in Example 4 of this note.
I assume (although you didn't specifically say this) that you want to test if Model 2 (the full model) predicts significantly better than Model 1 (the reduced model).
This is called the Extra Sum of Squares test. Here is a description: http://www.stat.tugraz.at/courses/files/s07.pdf. You can obtain the required quantities from the PROC GLM output and then do the calculations yourself.
This can be done with the CONTRAST statement in PROC GENMOD as discussed and illustrated in Example 4 of this note.
@StatDave is there some searchable database you have that enables you to always pop up and provide links to helpful SAS documents? Because if I click on the magnifying glass icon at the top right of the SAS Communities and type in "Comparing nested models" or "CONTRAST compare nested models", I don't find the link you provided.
Use instead the search available at the top of the support.sas.com page. That will also provide a link to the Vuong macro which is mentioned in the note I referred to and which can also do the likelihood ratio test.
Thanks, @StatDave. That seems to be the same search as at the top right of the SAS Communities pages, and in both cases, the page you linked doesn't appear. Google, however, finds the page you linked immediately by searching for: "compare nested models" SAS
They do the same search if you choose support.sas.com in the selector to the left of the search field. A more specific source that is better for this question and many other "(how) does SAS do ..." questions is the Frequently Asked-for Statistics link (known as FASTats) which is available in the Important Links list on the STAT Communities page. See the "Likelihood ratio test for model comparison" item in the FASTats which takes you directly to the place I mentioned.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.