Programming the statistical procedures from SAS

McFadden’s R2 in logistic REGRESSION

Accepted Solution Solved
Reply
Contributor
Posts: 37
Accepted Solution

McFadden’s R2 in logistic REGRESSION

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 

 

 


Accepted Solutions
Solution
‎03-12-2018 06:09 AM
SAS Employee
Posts: 386

Re: McFadden’s R2 in logistic REGRESSION

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


All Replies
Highlighted
Super User
Posts: 10,770

Re: McFadden’s R2 in logistic REGRESSION

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

Contributor
Posts: 37

Re: McFadden’s R2 in logistic REGRESSION

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

SAS Employee
Posts: 97

Re: McFadden’s R2 in logistic REGRESSION

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. 

Solution
‎03-12-2018 06:09 AM
SAS Employee
Posts: 386

Re: McFadden’s R2 in logistic REGRESSION

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;

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 409 views
  • 0 likes
  • 4 in conversation