I want to test for efficacy of an intervention. I have pre- and post-intervention data and I used auto.arima
to find the best fit for the two data sets.
I'm stuck in the actual use of these models now. What do I do with the auto.arima
fit? Can I graph it and test for statistically significant differences in the coefficients? If so, how do I graph it?
This is what I have right now ( specified from auto.arima
)
myPreFit<-arima(myPre,order=c(0,1,0))
myPostFit<-arima(myPost,order=c(1,0,1))
Best Answer
Time series intervention analysis is not like this. First, you have to model regular ARIMA model for preintervention period and find the order of appropriate ARIMA model. Then you have to use the order in ARIMAX model (taking whole period, pre+post intervention), including a dummy variable. model1 = forecast::auto.arima(ts_model1, trace = TRUE, seasonal = TRUE, stationary = FALSE,ic = c("aicc", "aic", "bic"),stepwise = TRUE, allowmean = TRUE, allowdrift = TRUE) #ts_model1 is only for preintervention period
Best model: ARIMA(1,1,1)(1,0,0)[12]
model2 = TSA::arimax(ts_model2, order = c(1, 1, 1), seasonal = list(order = c(1, 0, 0), period = 12), xreg = ts_model4, method = c("CSS-ML", "ML", "CSS"), kappa = 1e+06, xtransf =dummy, transfer = list(c(1,0))) I hope you understand.