BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Achieng
Quartz | Level 8

Dear friends,

I would like to  use the McFadden’s R

for my model fit in logistic regressions.

 

I am running sequential adjusted regression models.

 

Model 1 = crude model with fatty acid patterns only.

model 2 = adjusted for age and gender

Model 3 =  adjusted for lifestyle confounders,

 

*model 1;
proc logistic data=Alisama;*plasma FA;
model Weightchange_Indicator (event='1')= SCD_D9D_Plasma_2005 n6_PLASMA_2005 n3_PLASMA_2005 EFA_PLASMA_2005 / rsq  ;/*put the model in this form -> response = predictors*/
run;quit;



*model 2;
proc logistic data=Alisama;*plasma FA;
class Gender_Code_2005;*put categorical variables here*/;
model Weightchange_Indicator(event='1')= SCD_D9D_Plasma_2005 n6_PLASMA_2005 n3_PLASMA_2005 EFA_PLASMA_2005 Age2005 Gender_Code_2005   / rsq;/*put the model in this form -> response = predictors*/
run;quit;


*model 3;
proc logistic data=Alisama;*plasma FA;
class Gender_Code_2005 Urbanisation_2005 Tobbaco_2005 Education_2005;/*put categorical variables here*/
model  Weightchange_Indicator(event='1')= SCD_D9D_Plasma_2005 n6_PLASMA_2005 n3_PLASMA_2005 EFA_PLASMA_2005 Age2005 Gender_Code_2005  
               Gender_Code_2005 Urbanisation_2005  FFQALCOHOL_2005 Tobbaco_2005 Education_2005 
               FFQKJOUL_2005 Weighted_PA_Index_2005 / rsq;/*put the model in this form -> response = predictors*/
run;quit;

the model fit I generated only includes these three 

Model Fit Statistics 
Criterion Intercept Only Intercept and
Covariates 
AIC 565.422 558.473 
SC 569.441 578.566 
-2 Log L 563.422 548.473 

I know I can use the loglikelihood, But I would prefer to use the McFadden’s R2

 

So how do I generate the McFadden’s R2?????

 

Please help.

Very kind regards

Achieng 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
StatDave
SAS Super FREQ

You can also get McFadden's R-square in PROC HPLOGISTIC by using the PARTITION statement. Note that you do not have to actually do any partitioning of your data. For example:

 

proc hplogistic data=remiss;
model remiss(event='1') = smear blast;
partition fraction(test=0 validate=0);
run;

View solution in original post

4 REPLIES 4
Ksharp
Super User

I think you do the right thing.

 

proc logistic data=sashelp.class;
model sex=age weight height/rsquare;
run;

 

 

 

R-Square0.3724Max-rescaled R-Square0.4970

Achieng
Quartz | Level 8
Dear Ksharp, I was unable to get the Mcfaddens R2 with this method, but
instead, I got other models fit models. Thank you.

SAS_Rob
SAS Employee

Several different R-square measures, including McFadden's, are computed by PROC QLIM in SAS/ETS software.  LOGISTIC only reports the R-square based on the method of Cox and Snell. 

 

 If you fit a model like this in PROC LOGISTIC: 

proc logistic; 
  model y=x1 x2 x3 / rsquare; 
  run; 

you can fit the same model in PROC QLIM like this: 

proc qlim; 
  model y=x1 x2 x3 / discrete(d=logistic); 
  run; 

and it will print all the R-square measures by default. 

StatDave
SAS Super FREQ

You can also get McFadden's R-square in PROC HPLOGISTIC by using the PARTITION statement. Note that you do not have to actually do any partitioning of your data. For example:

 

proc hplogistic data=remiss;
model remiss(event='1') = smear blast;
partition fraction(test=0 validate=0);
run;

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 4 replies
  • 7513 views
  • 0 likes
  • 4 in conversation