Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Regression models with restricted cubic splines

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted a month ago
(878 views)

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

> 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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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."

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

@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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Use PROC GLIMMIX with the EFFECT statement.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Try the following ESTIMATE Statement --

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

Thanks,

Jill

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. **Registration is now open through August 30th**. Visit the SAS Hackathon homepage.

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.