BookmarkSubscribeRSS Feed
medic
Fluorite | Level 6

Hi SAS experts,

 

I'm trying to do an interrupted time series (ITS) analysis to compare before and after certain intervention.

(Ref. https://academic.oup.com/ije/article/46/1/348/2622842)

 

From the reference, here are the steps I went through so far.

 

1.I prepared the dataset with variables  (1) outcome (2) t_before [serial count 1,2,3...] (3) intervention [0 or 1] (4) t_after [0,0,0,...intervention... , 1, 2, 3...]

 

 

2. Then I used PROC ARIMA identify to check for the stationarity as follows:

proc arima data=sample;
identify var=outcome stationarity=(adf);
run;

since the result showed that 'outcome' is nonstationary, I used first-order difference as follows and the test showed stationary:

proc arima data=sample;
identify var=outcome(1) stationarity=(adf);
run;

 

3. and from the ACF, PACF plots from above, I thought AR(5) model would fit, so I tried final diagnosis as: 

proc arima data=sample;
identify var=outcome(1) ;
run;

estimate p=5;
run;

and the result seemed reasonable.

 

 

So, here is my question.

0. the ITS equation I want to use is :  outcome  =   t_before(b1 -> previous trend)  intervention(b2 -> level change)  t_after(b3 -> trend change) , under  ARIMA (5, 1, 0) model

 

1. if so, how can I put this equation into PROC ARIMA to get the coefficients of b1, b2, and b3?

some references seem to use PROC MODEL, or PROC AUTOREG, but I don't think those cases consider the ARIMA  (because those programs have no coded lines such as 'p=~~', 'q=~~' or checking ACF, PACF and so on)

 

2. if I also want to estimate the slope of post trend, which is (b1+b3), how should I code to get the estimation and the p-value for (b1+b3)

 

 

I attached the sample dataset.

Thanks for your help in advance

1 REPLY 1
rselukar
SAS Employee

Try

proc arima data=sample;
identify var=outcome(1) crosscorr=intervention noprint;
estimate p=1 input=intervention method=ml;
quit;

 

Note:

1.  I have reduced your p=5 to p=1 because the higher order coefficients are not very significant.  The residual plots appear OK.

2.  The pre-intervention slope (MU in this case) is estimated as -0.72433, which seems reasonable since the outcome is trending downward prior to intervention.

3.  Post-intervention slope, MU + intervention coefficient, turns out to be (-0.72433 + 12.49581).

 

Hope this works for you.

 

By the way, for carrying out more general types of analyses described in the paper you mention it is easier to use PROC SSM.  This is a newer procedure than ARIMA and provides much broader support for time series modeling and intervention analysis.  The learning curve for PROC SSM is a bit steep but I think worth taking a look.  See 

Selukar, R. S. (2017). “Detecting and Adjusting Structural Breaks in Time Series and Panel Data Using the SSM Procedure.” In Proceedings of the SAS Global Forum 2017 Conference. Cary, NC: SAS Institute Inc. http://support.sas.com/resources/papers/proceedings17/SAS0456-2017.pdf

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 925 views
  • 1 like
  • 2 in conversation