# Segmented Regression With Control Group Implementation and Interpretation

I have been reading the following paper on segmented regression for interrupted time series - Wagner 2002 and wanted to learn a proper analysis of such data where there is a control group. The paper mentions it, but doesn't show how to incorporate it. The data below is hypothetical situation I face where there are multiple retail stores in a chain and 2 stores were chosen for an intervention and 2 additional stores that had similar pre-intervention trend as the intervention stores were chosen for comparison. The series are shorter than in the paper. The intervention occurred between period 3 and 4 (at end of period 3).

Key Fields in the Data:

• TIME: numeric 1 to 6 for the 6 periods of data
• TRT: 1= in the treated group. 0= control group.
• INT: 1=the period (TIME) is in the intervention. 0= before the intervention
• MONTHSFROM_INT: numeric 0 to 3 which is number of periods since the intervention (TIME -3)
• STORE: The store (1, 2, 3 or 4)

I fit this model to the data with the following output:

$Y=\beta_{0}+\beta_{1}TIME+\beta_{2}INT+\beta_{3}(TIME-3)+\beta_{4}TRT+\beta_{5}(INT$ x $TRT)+\beta_{6}((TIME-3)$ x $TRT)+\epsilon$

mod<-gls(Y~TIME+INT+MONTHSFROM_INT+TRT+INT*TRT+MONTHSFROM_INT*TRT, data=dat,correlation = corAR1(form=~TIME | STORE))
summary(mod)
Coefficients:
Value Std.Error   t-value p-value
(Intercept)         4.038194 0.3915583 10.313135  0.0000
TIME               -0.055087 0.1278101 -0.431008  0.6719
INT                -0.642986 0.3620565 -1.775926  0.0936
MONTHSFROM_INT      0.046872 0.2333187  0.200893  0.8432
TRT                 0.699415 0.4190975  1.668859  0.1135
INT:TRT            -1.902439 0.5114081 -3.720002  0.0017
MONTHSFROM_INT:TRT  0.243914 0.2513041  0.970594  0.3454


QUESTIONS:

1. Confirmation. Is this the proper way to analyse a replicated (2 store) interrupted time series with a segmented regression (with a control)? I know there are other methods (e.g. longitudinal model using a mixed model) but require more data (more stores).

2. Interpretation of the "effect" of the intervention. Is this correct and explains the results:

A) The significant (positive) TRT coefficient $\beta_{4}$ means that there is a positive level shift for the treatment group before the intervention.

B) The significant (negative) INT x TRT interaction $\beta_{5}$ provides evidence that indeed the treated group shifted downward more than the control group during the intervention.

C) The non-significant MONTHSFROM_INT x TRT coefficient $\beta_{6}$ means there is no evidence that the slope of the time variable during the intervention is different for treated versus control.

Overall, the intervention produced a negative level shift but not a significant change in trend.

1. How would I use the model to estimate the absolute number of units of Y that decreased during the intervention (period 4,5,6) due to the intervention?

Data:

dat<-structure(list(Y = c(5.17, 5.15, 5.2, 2.6, 2.8, 2.75, 4.2, 3.3,
4.2, 2.1, 2.3, 2.8, 4.2, 4.1, 3.9, 3.2, 3.5, 3.3, 3.9, 3.5, 3.7,
3.1, 3.4, 3), TIME = c(1L, 2L, 3L, 4L, 5L, 6L, 1L, 2L, 3L, 4L,
5L, 6L, 1L, 2L, 3L, 4L, 5L, 6L, 1L, 2L, 3L, 4L, 5L, 6L), INT = c(0L,
0L, 0L, 1L, 1L, 1L, 0L, 0L, 0L, 1L, 1L, 1L, 0L, 0L, 0L, 1L, 1L,
1L, 0L, 0L, 0L, 1L, 1L, 1L), MONTHSFROM_INT = c(0L, 0L, 0L, 1L,
2L, 3L, 0L, 0L, 0L, 1L, 2L, 3L, 0L, 0L, 0L, 1L, 2L, 3L, 0L, 0L,
0L, 1L, 2L, 3L), STORE = c(1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L,
2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L),
TRT = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L)), .Names = c("Y",
"TIME", "INT", "MONTHSFROM_INT", "STORE", "TRT"), class = "data.frame", row.names = c(NA,
-24L))

• Paging @Andy :) – B_Miner Aug 29 '15 at 15:08

1. Confirmation. Is this the proper way to analyse a replicated (2 store) interrupted time series with a segmented regression (with a control)? I know there are other methods (e.g. longitudinal model using a mixed model) but require more data (more stores).

2. Interpretation of the "effect" of the intervention.

• If you use the above approach everything will be controlled for including seasonality, trend and other features of time series and clearly separate out intervention effects.
3. How would I use the model to estimate the absolute number of units of Y that decreased during the intervention (period 4,5,6) due to the intervention?

• for a series this short, simply normalize the values, and find out the difference. This will be the impact of intervention, this works very well in practice for short time series.

An excellent reference material are seminal work by Box and Tiao,and Glenn v Glass and this book by same author. Another excellent work in structural time series area using control series and intervention modeling is by Harvey.

Hope this helps.

• Seems like interpreted time series using segmented regression to determine changes in level and slope (trend) is a valid method, but there are alternatives as you point out. Agree? The approach in my question (but without replicated test series) is shown in the paper I linked and an upcoming course I was thinking of taking: edx.org/course/policy-analysis-using-interrupted-time-ubcx-itsx. – B_Miner Sep 6 '15 at 14:25
• Is there any open access to the papers? I have never seen an example of an intervention analysis (as has been discussed in many of my recent questions) using a control series! – B_Miner Sep 6 '15 at 14:26
• Both Harvey's and the second article can be read online but requires registration in JSTOR. – forecaster Sep 6 '15 at 14:30
• Agree, segmented regression does not control for time series components, and has to be explicitly specified, removed "no" from my answer. I was trying to point out that there are better alternatives. – forecaster Sep 6 '15 at 14:31
• One challenge is about replication. Can intervention analysis (Arima ala Pankratz book) deal with multiple treated series? – B_Miner Sep 6 '15 at 18:24