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. [[alternative HTML version deleted]]
Hi R-users, I have a time series with different impacts I want to evaluate. An appropriate model, for a particular impact input variable is: Y_t=(w/(1-d)B) X_t + ARIMA part, using notation as in Box and Tiao (1975) I would like to know if there exists a library with which I could estimate this model, or with if with arima(y, order=c(0, 0,1), xreg=" ") do it. SAS call them transfer functions and easily acomodate them using proc ARIMA estimate q=1 input=(/(1)x) ; Please if someone is sure that it is not possible in R, please let me know as well!!! Thanks, Berta [[alternative HTML version deleted]]
Spencer Graves
2006-Mar-04 00:02 UTC
[R] interrupted time series analysis using ARIMA models
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 Iwould 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 toincorporate them using the arima comand (or other), or a statistical package which can incorporate it?> > Thanks, > > Berta. > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
GlaciarDear 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 Iwould 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 toincorporate them using the arima comand (or other), or a statistical package which can incorporate it?> > Thanks, > > Berta.-------------- next part -------------- An HTML attachment was scrubbed... URL: https://stat.ethz.ch/pipermail/r-help/attachments/20060306/1c02153a/attachment-0003.html -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/jpeg Size: 2743 bytes Desc: not available Url : https://stat.ethz.ch/pipermail/r-help/attachments/20060306/1c02153a/attachment-0003.jpe
Spencer Graves
2006-Mar-10 03:41 UTC
[R] interrupted time series analysis using ARIMA models
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. > > > > >
Hi Berta, Did you have any luck finding code for the gradual permanent impact intervention? I am trying to fit two types of intervention effects for two different models - a gradual and a sudden impact effect - and unable to find any code on how to do this. thanks Jon -- View this message in context: http://r.789695.n4.nabble.com/interrupted-time-series-analysis-using-ARIMA-models-tp794821p3510253.html Sent from the R help mailing list archive at Nabble.com.
Roy Mendelssohn
2011-May-09 21:02 UTC
[R] interrupted time series analysis using ARIMA models
Look at: de Jong, P. and Penzer, J. (1998) Diagnosing shocks in time series. Journal of the American Statistical Association. 93, 796-806. A pdf is available at: http://stats.lse.ac.uk/penzer/publications.html -Roy M. On May 9, 2011, at 1:32 PM, jpehsani wrote:> Hi Berta, > > Did you have any luck finding code for the gradual permanent impact > intervention? > > I am trying to fit two types of intervention effects for two different > models - a gradual and a sudden impact effect - and unable to find any code > on how to do this. > thanks > Jon > > -- > View this message in context: http://r.789695.n4.nabble.com/interrupted-time-series-analysis-using-ARIMA-models-tp794821p3510253.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.********************** "The contents of this message do not reflect any position of the U.S. Government or NOAA." ********************** Roy Mendelssohn Supervisory Operations Research Analyst NOAA/NMFS Environmental Research Division Southwest Fisheries Science Center 1352 Lighthouse Avenue Pacific Grove, CA 93950-2097 e-mail: Roy.Mendelssohn at noaa.gov (Note new e-mail address) voice: (831)-648-9029 fax: (831)-648-8440 www: http://www.pfeg.noaa.gov/ "Old age and treachery will overcome youth and skill." "From those who have been given much, much will be expected"