Programming the statistical procedures from SAS

Genmod NB regression

Reply
Occasional Contributor
Posts: 16

Genmod NB regression

I'm so new to SAS, and I need to do NB regression using Genmod procedure for my project. it's proved that there is a correlation between the data I've got. but when I apply my data, it estimates the parameter by 0.
Could anybody help me? This is how I did it:
"data crash;
input major minor accident;
datalines;
19331 18358 10
17215 17051 10
18539 17562 9
42890 14750 38
43187 14600 46
44136 14020 44
60903 9819 41
59018 10547 49
65205 11292 40
31969 21677 40
31808 23356 31
28179 19647 45
29020 38400 78
29100 38408 64
29080 39560 54
31969 25190 57
31808 25481 51
28179 25092 49
32172 34898 56
33412 35950 41
32068 33307 50
30217 15094 41
30581 16782 31
32458 16560 33

run;
proc genmod data=crash;

model accident = major minor / dist=negbin link=log;
run; "
Valued Guide
Valued Guide
Posts: 679

Re: Genmod NB regression

Your predictors are very large relative to the response variable. SAS is rounding the parameter estimates to 0.0000, even though they are not really 0. In a data step, add:
major1=major/10000;
minor1=minor/10000;

Then, use major1 and minor1 in the model statement of genmod. You will get correct nonzero parameter estimates. In reporting or using the results, remember to rescale the parameters by dividing by 10000.
Occasional Contributor
Posts: 16

Re: Genmod NB regression

I've been struggling with this for awhile and now it works. I really appreciate itSmiley Happy
Occasional Contributor
Posts: 16

Re: Genmod NB regression

One more question. in proc genmod, is there anyway I can see the functional form of the regression model. For this example how these variables are related?
Thanks
Valued Guide
Valued Guide
Posts: 679

Re: Genmod NB regression

You need to clarify what you mean.
Occasional Contributor
Posts: 16

Re: Genmod NB regression

what is the mathematical relationship between accident as dependent variable and major and minor as explanatory variables?
Valued Guide
Valued Guide
Posts: 679

Re: Genmod NB regression

This is given explicitly in the table of maximum likelihood estimates in the output. Each line is the parameter estimate for the predictor variable. Note that everything is in the scale of the link function used. You need to read the online documentation -- many examples of interpretation of the output.
Occasional Contributor
Posts: 16

Re: Genmod NB regression

I think this is what you mean:
Analysis Of Maximum Likelihood Parameter Estimates

Standard Wald 95% Confidence Wald
Parameter DF Estimate Error Limits Chi-Square Pr > ChiSq

Intercept 1 1.8966 0.3498 1.2111 2.5822 29.40 <.0001
major1 1 0.0271 0.0063 0.0147 0.0395 18.32 <.0001
minor1 1 0.0378 0.0075 0.0232 0.0524 25.79 <.0001
Dispersion 1 0.0610 0.0277 0.0251 0.1484

NOTE: The negative binomial dispersion parameter was estimated by maximum likelihood.


this shows the estimated parameters for each variable. my question is that what is the functional form. Is it like
accident= 0.0271(major1)+0.0378(minor1)+1.8966
or is there any option that shows how do they relate?
thanks
Valued Guide
Valued Guide
Posts: 679

Re: Genmod NB regression

That's it. But note, the left hand side is log(expected number of accidents), since you use a log link function.
Regular Contributor
Posts: 169

Re: Genmod NB regression

For generalized linear models, the inverse of the link function transforms the linear predictor eta back to produce the expected value of the response. When you employ a log link (as you stated in your first post), the inverse of the log link is exponentiation, and the expected value of the response is given as

E(Y) = exp(eta)

where

eta = 1.8966 + 0.0271*major1 + 0.0378*minor1
Occasional Contributor
Posts: 16

Re: Genmod NB regression

so Log link is actually natural log or ln. is that correct?
Regular Contributor
Posts: 169

Re: Genmod NB regression

Yes.
Occasional Contributor
Posts: 16

Re: Genmod NB regression

Is there anyway in genmod procedure with NB dist that you can get a different parameter "α" beside the main parameters and overdispersion?
Occasional Contributor
Posts: 16

Re: Genmod NB regression

There is also another problem, I used the following to see the fitted model graph
ods graphic on;
proc genmod data=crash;

model accident = major minor / dist=negbin link=log;
assess link / resample=10000
seed=603708000
crpanel;

run;
ods graphics off;
but it doesn't shoe anything in panel of cumulative sum residual plot. Do I need to modify anything?
Thanks.
Ask a Question
Discussion stats
  • 13 replies
  • 144 views
  • 0 likes
  • 3 in conversation