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
- /
- Binomial regression model with 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
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-17-2015 10:44 AM

Hello-

I'm attempting to run a binomial regression on a data set using the genmod function.

I am supposed to end up with an alpha hat (or intercept) value of .456, but I am getting a value of -.1761. However, the Pearson chi-square and scaled Pearson chi-square values (35.5) are correct.

I am able to get the correct answer in R, but I must have something wrong in SAS.

Below is my code:

data x;

input Game Success Attempts;

cards;

1 4 5

2 5 11

3 5 14

4 5 12

5 2 7

6 7 10

7 6 14

8 9 15

9 4 12

10 1 4

11 13 27

12 5 17

13 6 12

14 9 9

15 7 12

16 3 10

17 8 12

18 1 6

19 18 39

20 3 13

21 10 17

22 1 6

23 3 12

;

run;

proc genmod data=x;

model Success/Attempts = /link=logit dist=binomial type1 type3;

run

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

Posted in reply to Andrew1

02-17-2015 12:30 PM

You are getting the intercept on the logit link scale. The inverse link is

1/(1+exp(-(-0.1761))) = .456, the required answer.

I can get this directly by using GLIMMIX instead of GENMOD, with the ILINK option on an ESTIMATE statement.

proc glimmix data=x;

model Success/Attempts = / link=logit dist=binomial s ;

estimate 'intercept' int 1 / **ilink** ;

run;

This gives you the logit link intercept (-.1761), *and* the inverse link (labeled mean; .456). However, the ILINK option is not valid in GENMOD. I don't use GENMOD a lot, but I am not aware of an easy way to get the inverse link with this procedure.

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

02-19-2015 11:31 AM

Would

estimate 'Intercept' int 1 / EXP ;

provide the same information in GENMOD?

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

Posted in reply to Rick_SAS

02-19-2015 12:12 PM

Rick's approach works when one is using the log link. But the OP is using the logit link (which is the default and canonical link for the binomial). I am surprised that GENMOD does not have an ILINK option. I use is all the time with GLIMMIX.

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

02-19-2015 02:08 PM

Now grasping for a straw, but would it make any sense to add a dummy variable, add the NOINT option, and use the LSMESTIMATE statement, which supports the ILINK option???

data y;

set x;

dummy = 1;

run;

proc genmod data=y;

class dummy;

model Success/Attempts = dummy / NOINT link=logit dist=binomial type1 type3;

lsmestimate dummy "Intercept" 1 / ilink;

run;

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

Posted in reply to Rick_SAS

02-19-2015 04:01 PM

A nice trick by Rick to get the inverse link.

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

02-19-2015 05:00 PM

Another general approach is to put the GENMOD results in an **item store**, and then use PROC PLM for post-model-fit processing. The ESTIMATE statement in PLM allows for an ILINK option. This way you don't need to use a dummy variable for the intercept.

proc genmod data=x;

model Success/Attempts = / link=logit dist=binomial type1 type3;

**store results;**

run;

proc plm **restore=results**;

estimate 'intercept' int 1 / ilink;

run;

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

Posted in reply to Andrew1

02-22-2015 09:22 AM

As I see it, Rick's approach by adding the line

estimate 'Intercept' int 1 / EXP ;

in proc genmod is the easiest way to get the estimate on the probability scale. It works both with log-link and log-link. Only difference is that the confidence interval is slightly difference. The other suggested solutions also works, but I see no reason to make it more complicated.

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

Posted in reply to JacobSimonsen

02-22-2015 10:11 AM

Jacob, You can only use the EXP option with the log link, **not** with the logit link. If your probability is low (say, <0.10 or so), then the logit is approximately the same as the log. Thus, the EXP option may appear to work for both link functions. But you could get seriously wrong answers in general if you used this with the logit link.

ADDITION (EDIT): Let me slightly correct myself. The EXP option does give the inverse link for a log, **not** for a logit. Thus, as I wrote above, the output line for the EXP option would be misleading (wrong) if you used the logit link. However, I just realized that you get the correct inverse link if you just used:

estimate 'intercept' int 1 ;

That is, you get a second line of results with the correct inverse link just by using an estimate statement (without the EXP option). It happens automatically in GENMOD (unlike in GLIMMIX), so that is why there is no ILINK option. If you also add the EXP option, you get an additional line of (possibly) meaningless results if you are not using a log link.

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

02-22-2015 10:26 AM

I agree that the EXP-option will not work with the logit-link. That was not what I meant. The estimate-statement automatically produce the correct estimate on probability scale.

Below is the output when the log-link is used. The "Mean Estimate" gives the probability estimate, and also confidence intervals are produced (in bold). Almost same output if logit is used as link.

estimate 'intercept' intercept 1;

Mean | Mean | L'Beta | Standard | L'Beta | Chi- | |||

Label | Estimate | Confidence Limits | Estimate | Error | Alpha | Confidence Limits | Square | Pr > ChiSq |

intercept | 0.4561 | 0.4027 | 0.5165 | -0.7851 | 0.0635 | 0.05 | -0.9095 | -0.6607 | 152.98 | <.0001 |

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

Posted in reply to JacobSimonsen

02-22-2015 10:30 AM

Our posts crossed in the ether. I just updated my earlier post (check it out) with the same information. As I wrote, and you correctly discovered, you automatically get the correct inverse link just by using an estimate statement (without an EXP option).

Good luck.