BookmarkSubscribeRSS Feed
Najmeh
Calcite | Level 5
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; "
13 REPLIES 13
lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12
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.
Najmeh
Calcite | Level 5
I've been struggling with this for awhile and now it works. I really appreciate it:)
Najmeh
Calcite | Level 5
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
lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12
You need to clarify what you mean.
Najmeh
Calcite | Level 5
what is the mathematical relationship between accident as dependent variable and major and minor as explanatory variables?
lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12
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.
Najmeh
Calcite | Level 5
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
lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12
That's it. But note, the left hand side is log(expected number of accidents), since you use a log link function.
Dale
Pyrite | Level 9
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
Najmeh
Calcite | Level 5
so Log link is actually natural log or ln. is that correct?
Dale
Pyrite | Level 9
Yes.
Najmeh
Calcite | Level 5
Is there anyway in genmod procedure with NB dist that you can get a different parameter "α" beside the main parameters and overdispersion?
Najmeh
Calcite | Level 5
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.

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
  • 13 replies
  • 1977 views
  • 0 likes
  • 3 in conversation