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.
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
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
> 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
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."
@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
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.
Use PROC GLIMMIX with the EFFECT statement.
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
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
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.
Try the following ESTIMATE Statement --
estimate 'month 15 vs. 7' tspl [1, 15][-1,7] / exp;
Thanks,
Jill
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.
Hi Jill, how can we calculate risk difference for the same values?
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
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.