Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Overlaying three itsa graphs

    I am using Ariel Linden's excellent "itsa" package in Stata 17 for an interrupted time series analysis.

    Linden, A. (2015). "Conducting Interrupted Time-series Analysis for Single- and Multiple-group Comparisons." The Stata Journal;15(2): 480-500.


    I would like to be able to overlay three single group model graphs into one graph for illustrative purposes, rather than using the multigroup analysis as this only allows a comparison of two groups (as far as I have been able to ascertain). I have been able to use the overlay command with simple time series line graphs, but not with the segmented regression graphs which are generated from the itsa command.

    I have put together an example dataset for this question:

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float mdate long outcome float value
    696 1  7
    697 1  6
    698 1  7
    699 1  8
    700 1  9
    701 1 11
    702 1 14
    703 1  7
    704 1  6
    705 1  6
    706 1  8
    707 1  7
    696 2 45
    697 2 46
    698 2 44
    699 2 42
    700 2 40
    701 2 37
    702 2 36
    703 2 45
    704 2 45
    705 2 44
    706 2 44
    707 2 46
    696 3 20
    697 3 20
    698 3 21
    699 3 21
    700 3 20
    701 3 21
    702 3 21
    703 3 20
    704 3 21
    705 3 21
    706 3 20
    707 3 20
    end
    format %tm mdate
    label values outcome outcomelbl
    label def outcomelbl 1 "var1", modify
    label def outcomelbl 2 "var2", modify
    label def outcomelbl 3 "var3", modify

    Here is the simplified code for the three single group models, which each produce a graph as well as the model parameter statistics:
    Code:
     
    itsa value, single treat(1) trperiod (2018m4; 2018m8) replace figure
    
    itsa value, single treat(2) trperiod (2018m4; 2018m8) replace figure
    
    itsa value, single treat(3) trperiod (2018m4; 2018m8) replace figure
    For reference, and to demonstrate the difference, here is some code for a multi-group analysis comparing var1 as the control with var2 as the comparison group:
    Code:
     
    itsa value, treat (1) trperiod (2018m4; 2018m8) contid (2) replace figure
    I have searched Statalist, Stata help and several instructional videos so am hoping someone here may be familiar with Linden's package and able to help.

    Many thanks.
Working...
X