Programming the statistical procedures from SAS

Binomial regression model with genmod

Reply
Occasional Contributor
Posts: 5

Binomial regression model with genmod

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

Valued Guide
Valued Guide
Posts: 673

Re: Binomial regression model with genmod

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.

SAS Super FREQ
Posts: 3,306

Re: Binomial regression model with genmod

Would

estimate 'Intercept' int 1 / EXP ;

provide the same information in GENMOD?

Valued Guide
Valued Guide
Posts: 673

Re: Binomial regression model with genmod

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.

SAS Super FREQ
Posts: 3,306

Re: Binomial regression model with genmod

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;

Valued Guide
Valued Guide
Posts: 673

Re: Binomial regression model with genmod

A nice trick by Rick to get the inverse link.

Valued Guide
Valued Guide
Posts: 673

Re: Binomial regression model with genmod

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;

Super Contributor
Posts: 271

Re: Binomial regression model with genmod

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.

Valued Guide
Valued Guide
Posts: 673

Re: Binomial regression model with genmod

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.

Super Contributor
Posts: 271

Re: Binomial regression model with genmod

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'BetaStandard                 L'Beta         Chi-
Label    Estimate  Confidence Limits Estimate   Error Alpha  Confidence Limits SquarePr > ChiSq

intercept  0.4561  0.4027  0.5165 -0.7851  0.0635  0.05 -0.9095 -0.6607152.98    <.0001
Valued Guide
Valued Guide
Posts: 673

Re: Binomial regression model with genmod

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.

Ask a Question
Discussion stats
  • 10 replies
  • 513 views
  • 2 likes
  • 4 in conversation