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

Good morning everyone,

 

I have some differences concerning the results from a proc logistic and a proc genmod. Indeed, I've got a modality which seems to be significative with the proc logistic and not with the genmode.

I've already read the post from 2011  FROM HERE

I am using SAS 9.4 and already set the param=glm for the proc logistic.

Here is the codes :

proc logistic data=scorme.visconct; 
class &liste_var_choix./param=glm; 
model CARVPr (event = "1")= &liste_var_choix./selection=stepwise sle=0.05 sls=0.05 ; 
score data=scorme.visconct out=score;
run ;

 

proc genmod data=scorme.visconct; 
class &liste_var_choix.; 
output out=outglm p=pred; 
freq poids; 
model carvpr/poids = &liste_var_choix./d=bin; 
run;

 

the results are the following :

 

The proc Logistic:

Proc Logistic.png

 

The Proc Genmod:

Proc Genmod.png

 

As you can see, the madality Pnouv is not significative anymore and I can't see why.

For my analysis I use the proc logistic results but i'd like to compare with the genmod result if possible to confirm the model. If ever you'd want me to explain a bit more, don't hesite to ask.

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
Mishojo
Fluorite | Level 6

Thank you for your responses.

The issue was quite easy to correct : I just added an event="1" statement in the proc genmode (and removed the freq):

 

proc logistic data=scorme.visconct; 
class &liste_var_choix./param=glm;
model CARVPr (event = "1")= &liste_var_choix./selection=stepwise sle=0.05 sls=0.05 ;
score data=scorme.visconct out=score;
run ;

proc genmod data=scorme.visconct;
class &liste_var_choix.;
output out=outglm p=pred;
model carvpr (event="1") = &liste_var_choix./d=bin;
run;

 and the results are as follow :

 

Proc Logistic

Proc Logistic correct.png

 

Proc GENMOD

Proc Genmod Correct.png

 

 

I removed the FREQ because it was initially used to replicate the carvpr=1 but it didn't work as planned. Instead I used the same method as in the proc logistic and as you said, it worked !

 

The scores are also legit, so it's perfect.


Thank you very much for your help !

 

View solution in original post

7 REPLIES 7
Reeza
Super User

You have a FREQ statement in GENMOD but not one in LOGISTIC, is that intentional?

Do you also need the link=logit option in GENMOD?

 

 

Mishojo
Fluorite | Level 6

Concerning the FREQ proc, it's used to distinguish the modalities from the variable POIDS which were used to distinguish two subsets that we merged.. I don't understand why you are talking about a link=logit ? I didn't use any.

I'm not really used to it, any suggestion is welcome.

 

 

Reeza
Super User

My question is you're using the same dataset for both models, but you're specifying the models differently between the two procs (event/trials vs outcome).

 

 

If I use a similar situation with the same input and same specification the model comes out the same. 

 

Do you get the same, or at least very similar results from this code:

 

  data drug;
      input drug$ x r n @@;
      datalines;
   A  .1   1  10   A  .23  2  12   A  .67  1   9
   B  .2   3  13   B  .3   4  15   B  .45  5  16   B  .78  5  13
   C  .04  0  10   C  .15  0  11   C  .56  1  12   C  .7   2  12
   D  .34  5  10   D  .6   5   9   D  .7   8  10
   E  .2  12  20   E  .34 15  20   E  .56 13  15   E  .8  17  20
   ;
   run;

     proc genmod data=drug;
      class drug;
      model r/n = x drug / dist = bin
                           link = logit
                           lrci;
   run;

   proc logistic data=drug;
   class drug/param=glm;
   model r/n = x drug;
   run;
Mishojo
Fluorite | Level 6

Indeed, I've got the exact same values with the two proc from your example.

So you think that's it was an issue concerning the parameters used and the method itself ?

The fact is that the event="1" statement is necessary in order to estimate the model correctly, without it the results (the score afterwards) are not logic.

 

 EDIT :

Removing the freq and event statement seems to correct the issue. I'm going to complete the analysis to see if the results are consistent with what I should get.

Thank you

Mishojo
Fluorite | Level 6

Unfortunately, the results are not correct.
I'm trying to score the fact of having a premium Visa card (No confidential data), removing the event="1" statement shows that the women (sfem) have a better score that the men (shom) and I know that it's not logical.

 

Any idea to correct it ?

 

Here's the result of the scores :

Grille bad.png

 

 

PS : Pcad should also be the one with the highest score.

Reeza
Super User

You had a freq variable before. Why not include it in the model now? More importantly, should it be. Find the correct model definition first that meets your data structure then proceed with interpretation/analysis.

 

You were estimating two different models with your initial code  

Mishojo
Fluorite | Level 6

Thank you for your responses.

The issue was quite easy to correct : I just added an event="1" statement in the proc genmode (and removed the freq):

 

proc logistic data=scorme.visconct; 
class &liste_var_choix./param=glm;
model CARVPr (event = "1")= &liste_var_choix./selection=stepwise sle=0.05 sls=0.05 ;
score data=scorme.visconct out=score;
run ;

proc genmod data=scorme.visconct;
class &liste_var_choix.;
output out=outglm p=pred;
model carvpr (event="1") = &liste_var_choix./d=bin;
run;

 and the results are as follow :

 

Proc Logistic

Proc Logistic correct.png

 

Proc GENMOD

Proc Genmod Correct.png

 

 

I removed the FREQ because it was initially used to replicate the carvpr=1 but it didn't work as planned. Instead I used the same method as in the proc logistic and as you said, it worked !

 

The scores are also legit, so it's perfect.


Thank you very much for your help !

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 7 replies
  • 5594 views
  • 1 like
  • 2 in conversation