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
- /
- SAS Programming
- /
- SAS Procedures
- /
- Gam for Poisson rates (offset term)

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
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-12-2016 11:04 AM

Hi everyone,

I am trying to fit a GAM model with Poisson rates data which include an offset term. I have tried using this code:

proc gam data=mydata;

model dv=spline(x1) spline(x2) splineline(x3) / dist=poisson link=log offset=lexp anodev=norefit;

output out=mydout p;

run;

For some reason the offset term is indicated as an error in the log file.

I am not sure how can I indicate I am dealing with rates not with counts. If I do not specify an offset term, the smoothing is being done for the count data, right?

I also have a question about testing the linearity of the association - is this a sound procedure?

1. I wanted to test each of the independent variables to see if they display a linear or quadratic association with my dependent variable - that is why I tried using GAM.

2. In case GAM indicates only significant linear tends for all my predictors except for one, can I still use then proc genmod with an offset (which I ran; it worked just fine, assuming a linear association, no weird coefficients).

I was also considering using the proc adaptvereg, not sure that is a better option in my case.

Thank you very much for taking the time to read my post and to help me!

Best regards1

Accepted Solutions

Solution

05-12-2016
02:54 PM

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

05-12-2016 02:26 PM - edited 05-12-2016 02:30 PM

If you have SAS/STAT 14.1, I highly recommend switching to the GAMPL procedure, which is a completely rewritten faster implementation of GAM. You can see an example and links at the article "Nonparametric regression for binary response data in SAS". The GAMPL procedure handles Poisson data and supports the OFFSET= option.

Yes, the offset term enables you to fit rates (counts per time period).

In your syntax for PROC GAM, I am unfamiliar with the SPLINELINE effect. It is not in the documentation.

All Replies

Solution

05-12-2016
02:54 PM

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

05-12-2016 02:26 PM - edited 05-12-2016 02:30 PM

If you have SAS/STAT 14.1, I highly recommend switching to the GAMPL procedure, which is a completely rewritten faster implementation of GAM. You can see an example and links at the article "Nonparametric regression for binary response data in SAS". The GAMPL procedure handles Poisson data and supports the OFFSET= option.

Yes, the offset term enables you to fit rates (counts per time period).

In your syntax for PROC GAM, I am unfamiliar with the SPLINELINE effect. It is not in the documentation.

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

05-12-2016 02:44 PM

Hello Rick_SAS,

Thank you so much for your response and for the suggestions!

I am so sorry: the "splineline" was a typo - I meant "spline".

I also found a macro that is useful to test non-linearity - %glmcurv9 that I found here: http://www.hsph.harvard.edu/donna-spiegelman/software/.

I will perform a GAML analysis, too, and compare the results.

Thanks!

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

05-12-2016 03:52 PM

Hello Rick,

Sorry to bother you again, I was just wondering whether it is still possible to run GAM with an offset. It seems that it is not possible.

I only have access to BaseSAS on this computer, but I will use the student version of SAS/STAT14.1 and run GAML later on using my computer.

Thanks!

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

05-12-2016 03:56 PM

If you haven't already done so, please bookmark the SAS/STAT documentation. The doc for the GAM procedure contains all valid syntax. Just click the MODEL statement.

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

05-13-2016 08:28 AM

Hi again,

Thank you so much for all your help! Have a great weekend!