turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Difference between a proc logistic and a genmod

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-05-2016 11:35 AM

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:

The Proc Genmod:

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.

Accepted Solutions

Solution

02-05-2016
03:45 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-05-2016 03:33 PM - last edited on 02-05-2016 03:39 PM by Reeza

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 GENMOD**

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 !

All Replies

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-05-2016 11:45 AM

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?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-05-2016 11:54 AM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-05-2016 12:08 PM

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;
```

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-05-2016 02:24 PM - edited 02-05-2016 02:27 PM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-05-2016 02:42 PM

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 :

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-05-2016 03:07 PM

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

Solution

02-05-2016
03:45 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-05-2016 03:33 PM - last edited on 02-05-2016 03:39 PM by Reeza

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 GENMOD**

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 !