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
- /
- Genmod NB regression

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

05-19-2011 08:07 PM

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

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

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

Posted in reply to Najmeh

05-20-2011 08:31 AM

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.

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.

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

05-20-2011 10:01 AM

I've been struggling with this for awhile and now it works. I really appreciate it

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

05-24-2011 09:43 AM

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

Thanks

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

Posted in reply to Najmeh

05-24-2011 11:03 AM

You need to clarify what you mean.

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

05-24-2011 11:23 AM

what is the mathematical relationship between accident as dependent variable and major and minor as explanatory variables?

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

Posted in reply to Najmeh

05-24-2011 11:44 AM

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.

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

05-24-2011 12:01 PM

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

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

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

Posted in reply to Najmeh

05-24-2011 12:11 PM

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

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

Posted in reply to Najmeh

05-24-2011 12:18 PM

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

E(Y) = exp(eta)

where

eta = 1.8966 + 0.0271*major1 + 0.0378*minor1

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

Posted in reply to Dale

05-24-2011 02:09 PM

so Log link is actually natural log or ln. is that correct?

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

Posted in reply to Najmeh

05-25-2011 12:30 PM

Yes.

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

Posted in reply to Dale

05-26-2011 03:36 PM

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

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

Posted in reply to Najmeh

05-27-2011 04:26 PM

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.

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.