[R] interrupted time series analysis using ARIMA models

Spencer Graves spencer.graves at pdf.com
Fri Mar 10 04:41:47 CET 2006

	  I'm familiar with Box and Tiao (1975) intervention analysis;  I 
studied time series under Box and Tiao.  I don't know how to do that in 
R, but there must be a way.  Have you looked at the 'dse' bundle?  That 
comes with vignettes that make it relatively easy to learn (or at least 
to learn the capabilities covered in the vignettes).  The models you 
want may not be identified by the names with which you are familiar, but 
I believe they are probably available.  If you try that and still have 
questions, I suggest you consult the posting guide 
(www.R-project.org/posting-guide.html) for help in crafting another 
question that may attract quicker and more useful replies.

	  I also highly recommend the "zoo" package.  It won't help you solve 
the problem you mentioned, but it might help you keep time stamps with 
your data.  It, too, has a vignette to help people learn the capabilities.

	  hope this helps.
	  spencer graves

Berta wrote:

> Dear R-users, 
> Thanks Spencer for your suggestion, i think we are near but still that 
> is not what i am looking for.
> I think I was not clear using that notation for the impact: (yt= d * 
> yt-1 + w * It ), this yt is not my original series, it is only the impact,
> the series would be modeled as Yt=yt +Nt, with yt the impact written 
> above and Nt the ARIMA part of the model. Hence, Yt is the series (your 
> lh), and yt the impact.
> With your suggestion
> IntReg <- cbind(It=(1:48)>20, It.w=((1:48)>20)*(1:48),  
> It.lh=((1:48)>20)*c(0, lh[-48]) )
> arima(lh, order = c(1,0,0), xreg=IntReg)
>  I would have for the original series Yt=lh(t)
> lh(20)=0 + Nt.
> lh(21)=w + beta1*21 + beta2*lh(20) + Nt
> lh(22)=w + beta1*22 + beta2*lh(21) + Nt
> etc.
> What I am trying to model is a gradual permanent impact, which would 
> lead to:
> lh(t)= impact(t) + Nt
> lh(t)= w*It + d*yt-1 + Nt
> lh(20)= 0+ Nt
> lh(21)= w + Nt
> lh(22)= d*w + w + Nt
> lh(22)= (d^2)*w + d*w + w + Nt
> ...
> lh(n)=(d^n)*w +(d^(n-1))*w +....+(d^2)*w + d*w + w + Nt, which 
> asymptoticaly would be = w/(1-d) + Nt.
> In that way, I can model the impact not only as an abrupt permanent 
> impact (like a "step") but also as a gradual permanent impact (which 
> grows gradually, as a linear trend or as a parabolic grow trend, or 
> whatever) with just two parameters.  In SAS they are called denominator 
> factors for transfer functions for an input series. I also would like to 
> modelize an abrupt temporary impact (a high pick in the moment of the 
> impact decreasing gradually after it), but hopefully that will be easy 
> after knowing the first.....
> Any suggestion for implementing this would be very very well received!!
> Thank a lot in advance,
> Berta.
> ################ answer of Spencer .####################
> Does the following illustrate the kind of interevention model you want
> IntReg <- cbind(It=(1:48)>20, It.w=((1:48)>20)*(1:48),
>                It.lh=((1:48)>20)*c(0, lh[-48]) )
>       arima(lh, order = c(1,0,0), xreg=IntReg)
>   hope this helps.
>   spencer graves
> Berta wrote:
>  > Hi R-users,
>  > 
>  > I am using arima to fit a time series. Now I
> would like to include an intervention component
> "It (0 before intervention, 1 after)" using
> different types of impacts, that is, not only
> trying the simple abrupt permanent impact (yt =
> w It ) with the xreg option but also trying with
> a gradual permanent impact (yt= d * yt-1 + w * It ),
> following the filosophy of Box and Tiao (1975).
> Intervention analysis with applications to economic
> and environmental problems. JASA 70: 70-92.
>  >
>  > Does anybody know where could I find how to
> incorporate them using the arima comand (or other),
> or a statistical package which can incorporate it?
>  >
>  > Thanks,
>  >
>  > Berta.

More information about the R-help mailing list