5

I have Malaria incidence data from 2003 to 2013. There was intervention implemented in 2008. How can I do segmented regression analysis of interrupted time series in R to test whether the pre intervention slopes are different from post-intervention slopes?

1 Answers1

7

One usually distinguishes two patterns of change (continuous with change in slope only, abrupt with shift plus change in slope) and whether or not the breakpoint is known.

If the breakpoint (= timing where the intervention became effective) were known, then the formula for the regression without intervation would be something like: y ~ time + .... And the continuous change in slope only would be: y ~ time + pmax(time - breakpoint, 0) + .... The shift that potentially changes both slope and intercept (i.e., might include an abrupt shift in addition to the slope change) is y ~ factor(time <= breakpoint) * time + ....

If you believe that the intervention became effective immediately, then you can do just fit the model without change and one of the models with change and carry out an anova().

However, usually it is not so clear when exactly such interventions become effective and then you need to estimate the breakpoint along with the intercept/slope. The segmented package is designed for models where only the slope changes and the strucchange package for models where all parameters change. Both packages are available from CRAN and have been described in several papers, see citation("segmented") and citation("strucchange"), respectively.

P.S.: Re-reading your question I realized that your slope might not just be a time trend but also a slope with respect to other regressors. In the explanations above you can also replace time with (an)other regressor(s) for your application.

Achim Zeileis
  • 13,510
  • 1
  • 29
  • 53