BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
statquestion1
Fluorite | Level 6

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

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

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

5 REPLIES 5
Rick_SAS
SAS Super FREQ

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.

statquestion1
Fluorite | Level 6

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!

statquestion1
Fluorite | Level 6

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!

Rick_SAS
SAS Super FREQ

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.

statquestion1
Fluorite | Level 6

Hi again,

 

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

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 Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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