BookmarkSubscribeRSS Feed
BayzidurRahman
Obsidian | Level 7

I need to fit a poisson model with offset including restricted cubic spline of a continuous covariate. I want to use the effect statement to automatically generate the spline variables at my preferred values. Can you please let me know what procedures can do it? I can see that proc genmod doesn’t allow select statement.

20 REPLIES 20
sbxkoenk
SAS Super FREQ

Splines are available in many procedures when you use the EFFECT statement.

The following procedures provide an EFFECT statement: GEE, GENMOD, GLIMMIX, GLMSELECT, HPMIXED, LOGISTIC, ORTHOREG, PHREG, PLM, PLS, PROBIT, QUANTLIFE, QUANTREG, QUANTSELECT, ROBUSTREG, SURVEYLOGISTIC, and SURVEYREG.

 

GENMOD is in the list!

 

Go to the Google search-bar and submit :

effect statement spline site:https://blogs.sas.com/content/iml

 

BR, Koen

sbxkoenk
SAS Super FREQ

Also, the TRANSREG procedure in SAS/STAT supports spline effects but has its own syntax.

You can enrich your dataset with new covariates (spline effects) using PROC TRANSREG and subsequently use the procedure of your choice.

 

Koen

Rick_SAS
SAS Super FREQ

> You can enrich your dataset with new covariates (spline effects) using PROC TRANSREG and subsequently use the procedure of your choice.

 

An easier choice is PROC GLMSELECT, which supports an OUTDESIGN= option. See the example at https://blogs.sas.com/content/iml/2019/10/16/visualize-regression-splines.html

Rick_SAS
SAS Super FREQ

I don't know where that sentence came from, but it is not correct. GENMOD does not support the EFFECT statement so the OP must use GLMMIX.

 

DOC for EFFECT stmt: SAS Help Center: EFFECT Statement says "This section applies to the following procedures: GLIMMIX, GLMSELECT, HPMIXED, LOGISTIC, ORTHOREG, PHREG, PLS, QUANTLIFE, QUANTREG, QUANTSELECT, ROBUSTREG, SURVEYLOGISTIC, and SURVEYREG."

sbxkoenk
SAS Super FREQ

@Rick_SAS wrote:

I don't know where that sentence came from, but it is not correct. GENMOD does not support the EFFECT statement so the OP must use GLIMMIX.


Oh. 🤐
That sentence came from SAS/STAT® 15.2 User's Guide.
Statistical Graphics Using ODS
The EFFECT and EFFECTPLOT Statements
SAS Help Center: The EFFECT and EFFECTPLOT Statements

 

Koen

Rick_SAS
SAS Super FREQ

Thanks. I have alerted the manager for that documentation. For the record, the GEE and GENMOD procedures support the EFFECTPLOT statement, but not the EFFECT statement.

jiltao
SAS Super FREQ

Use PROC GLIMMIX with the EFFECT statement.

BayzidurRahman
Obsidian | Level 7

Thanks for all of your support. the glimmix works.

My objective is to estimate incidence rate ratio (IRR) from the poisson model with splines for given values of the continuous variable. A manual process of doing that is described in the following presentation using Stata. Is there a simpler way to achieve the same in SAS?
https://www.stata.com/meeting/4nasug/RCsplines.pdf

jiltao
SAS Super FREQ

You might use the ESTIMATE statement in PROC GLIMMIX to get what you want. The exact syntax would depend on your data and model. What is your PROC GLIMMIX program and exactly what do you want to estimate?

Jill

BayzidurRahman
Obsidian | Level 7

Here is my code.

proc glimmix data=spl;
offset=log(psyc_den_m);
   effect tspl = spline(month_n/ details naturalcubic basis=tpf(noint)
             knotmethod=list(7, 15, 22, 28, 35) ); /* new in SAS/STAT 15.1 (SAS 9.4M6)  */
   model psyc_m_1 = tspl / dist=Poisson link=log offset=offset s;       /* fit model by using spline effects */
        ods select ParameterEstimates;
quit;

I want to estimate the incidence rate ration for month_n 15 vs 7 from the fitted model.

jiltao
SAS Super FREQ

Try the following ESTIMATE Statement --

estimate 'month 15 vs. 7' tspl [1, 15][-1,7] / exp;

Thanks,

Jill

BayzidurRahman
Obsidian | Level 7

Hi Jill,

Thanks very much. It works. Do you know how can we define scaled variance option in glimmix? SCALE = P option works in GENMOD but glimmix doesn't recognise this option.

BayzidurRahman
Obsidian | Level 7

Hi Jill, how can we calculate risk difference for the same values?

jiltao
SAS Super FREQ

You might be able to use the STORE statement in PROC GLMMIX then use the %NLESTIMATE macro to compute the risk difference. 

%NLESTIMATE macro is described in the details at the link below --

58775 - Estimating nonlinear combinations of model parameters (sas.com)

The Results tab has various examples showing how to use this macro.

Thanks,

Jill

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 20 replies
  • 1396 views
  • 10 likes
  • 5 in conversation