Help using Base SAS procedures

Gam for Poisson rates (offset term)

Accepted Solution Solved
Reply
New Contributor
Posts: 4
Accepted Solution

Gam for Poisson rates (offset term)

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
SAS Super FREQ
Posts: 3,477

Re: Gam for Poisson rates (offset term)

[ Edited ]

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.

View solution in original post


All Replies
Solution
‎05-12-2016 02:54 PM
SAS Super FREQ
Posts: 3,477

Re: Gam for Poisson rates (offset term)

[ Edited ]

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.

New Contributor
Posts: 4

Re: Gam for Poisson rates (offset term)

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!

New Contributor
Posts: 4

Re: Gam for Poisson rates (offset term)

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!

SAS Super FREQ
Posts: 3,477

Re: Gam for Poisson rates (offset term)

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.

New Contributor
Posts: 4

Re: Gam for Poisson rates (offset term)

Hi again,

 

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

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 376 views
  • 3 likes
  • 2 in conversation