I am running a single group interupted time series analyses to test the effect of an intervention. I have physical activity data before and after the intervention. I have successfully run this with XTITSA. I have looked at the effect for different strata across certain variables (e.g. age strata).
From examining the results, it looks like age is an effect modifier but I want to do a formal test to confirm this (either LRT or Wald) but am finding this challenging and am hoping for help with the code.
I am able to test with Wald but this is just for difference between the strata (e.g. a reference strata and another) as follows:
The example below shows gender:
**Run ITSA**
xtitsa activeminutes i.gender , single trperiod(0) vce(robust) posttrend figure replace
**Run with gender as interaction term**
xtgee activeminutes _t _x0##i.gender _x_t0, vce(robust)
**comparison between gender and intervention effect**
margins _x0#gender, pwcompare(effects) mcompare(sidak)
I'd like to test whether difference between the model with and without the interaction term (ie is it an effect modifier) and wondered if anyone can help with this. I tried to run the original model, store the estimates, run the model with the interaction, store the new estimates and then the lrtest command, but this does not work (see below).
**Run ITSA**
xtitsa activeminutes i.gender , single trperiod(0) vce(robust) posttrend figure replace
**Store estimate**
estimates store original
**Run with gender as interaction term**
xtgee activeminutes _t _x0##i.gender _x_t0, vce(robust)
**Store estimate**
estimates store interaction
**LRT**
lrtest original interaction, stats
Does anyone have any thoughts on how to do this?
From examining the results, it looks like age is an effect modifier but I want to do a formal test to confirm this (either LRT or Wald) but am finding this challenging and am hoping for help with the code.
I am able to test with Wald but this is just for difference between the strata (e.g. a reference strata and another) as follows:
The example below shows gender:
**Run ITSA**
xtitsa activeminutes i.gender , single trperiod(0) vce(robust) posttrend figure replace
**Run with gender as interaction term**
xtgee activeminutes _t _x0##i.gender _x_t0, vce(robust)
**comparison between gender and intervention effect**
margins _x0#gender, pwcompare(effects) mcompare(sidak)
I'd like to test whether difference between the model with and without the interaction term (ie is it an effect modifier) and wondered if anyone can help with this. I tried to run the original model, store the estimates, run the model with the interaction, store the new estimates and then the lrtest command, but this does not work (see below).
**Run ITSA**
xtitsa activeminutes i.gender , single trperiod(0) vce(robust) posttrend figure replace
**Store estimate**
estimates store original
**Run with gender as interaction term**
xtgee activeminutes _t _x0##i.gender _x_t0, vce(robust)
**Store estimate**
estimates store interaction
**LRT**
lrtest original interaction, stats
Does anyone have any thoughts on how to do this?
Comment