BookmarkSubscribeRSS Feed
mmaximos
Obsidian | Level 7

Hello SAS experts and enthusiasts,

 

I am trying to translate the following modeled equation into a proc genmod function for running a regression for the purpose of an interrupted time series analysis. There are 3 change points that I am interested in, hence 7 Beta coefficients .

 

Screen Shot 2023-05-25 at 9.07.12 PM.png

Where:

y= prescriptions

Bo= y-intercept

Bx*time(t)= estimated level change in prescriptions from start of observation period

Bx*time after intervention X (t)= time after the intervention has occurred in months (slope change)

Et= random variability error term

 

This is the code that I've generated to test the fitted model:

 

proc genmod data=its;  

    model prescriptions= obs intervention t_int1 intervention2 t_int2  intervention3 t_int3/ link=identity dist=normal;  

    output pred=pred;  

run;  

 

Would this be sufficient or do I have to enter the SAS code in the same manner as the model is written and if so, what would that look like?

 

Thank you!

2 REPLIES 2
Rick_SAS
SAS Super FREQ

You might want to start by reading the article, "Piecewise regression models and spline effects":

https://blogs.sas.com/content/iml/2017/04/05/nonsmooth-models-spline-effects.html

 

In that article, there is one CLAS variable that describes the time intervals. I guess your intervals are

"Before 1", 
"After 1 before 2"

"After 2 before 3"

and

"After 3"

 

You did not tell us whether the model is continuous at the changepoints. The article shows how to use GLM  and a CLASS statement for models that have a jump discontinuity at the intervention point. For continuous models, you can move to PROC GLMMIX and use the EFFECT statement to create a spline effect where the knots are placed at the intervention locations.

 

BTW, your model can also be handled by PROC GLM.

mmaximos
Obsidian | Level 7

Thank you @Rick_SAS  for your guidance and I will read the article. The model is continuous at the changepoints. I am aware I can use the PROC GLM function, thank you; I was hoping to use the PROC GENMOD function for the purpose of practice. 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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
  • 2 replies
  • 947 views
  • 3 likes
  • 2 in conversation