Jose Iparraguirre
2013-Feb-21 10:26 UTC
[R] Arimax with intervention dummy and multiple covariates
Hi I'm trying to measure the effect of a policy intervention (Box and Tiao, 1975). This query has to do with the coding of the model rather than with the particulars of my dataset, so I'm not providing the actual dataset (or a simulated one) in this case, apart from some general description. The time series are of length n=34 (annual observations between 1977 and 2010). The policy measure was introduced in 2000 and it has been implemented once a year ever since. The variable of interest (VI) is continuous, and I have four continuous covariates (CO1-CO4), plus the dummy intervention variable (DUM) which is equal to 0 between 1977 and 1999 and equal to 1 since 2000. I thought of using an ARIMAX model, with the arimax() function in the TSA package to fit the transfer function. I'm interested in modelling the intervention effect as a step function. I specified the model thus: a. I've checked the ARIMA properties of each series using the auto.arima() function (from the 'forecast' package) -the VI was found to best fit an ARIMA(0,1,1) model and the first covariate an ARIMA(1,0,0), whereas the other covariates were white noise. b. To facilitate the specification of the various models (the different model specifications dropped variables or added additional covariates, etc, without changing the general structure of the syntax below), I defined the following design matrix:> xreg.1 <- model.matrix(~CO1+ CO2+ CO3+ CO4)[,2:5]c. Following Cryer and Chan (2008, ch. 11, p. 255), I wrote models such as this:> arimax.1 <- arimax(VI, order=c(0,1,1),+ xtransf=data.frame(xreg.1,dummy1=DUM), + transfer=list(c(1,0),c(0,0),c(0,0),c(0,0),c(0,0))) d. So, I get estimates for the following coefficients: ma1; CO1-AR1; CO1-MA0; CO2-MA0; CO3-MA0; CO4-MA0; DUM-MA0 Can you spot any problems with the general modelling approach or in this specification? Many thanks in advance, José José Iparraguirre Chief Economist Age UK T 020 303 31482 E Jose.Iparraguirre@ageuk.org.uk<mailto:Jose.Iparraguirre@ageuk.org.uk> Twitter @jose.iparraguirre@ageuk Tavis House, 1- 6 Tavistock Square London, WC1H 9NB www.ageuk.org.uk<http://www.ageuk.org.uk> | ageukblog.org.uk<http://ageukblog.org.uk/> | @ageuk<http://twitter.com/ageukpa>campaigns Wrap Up and Run 10k is back! Also, new for 2013 – 2km intergenerational walks at selected venues. So recruit a buddy, dust off the trainers and beat the winter blues by signing up now: http://www.ageuk.org.uk/10k Milton Keynes | Oxford | Sheffield | Crystal Palace | Exeter | Harewood House, Leeds | Tatton Park, Cheshire | Southampton | Coventry Age UK Improving later life http://www.ageuk.org.uk ------------------------------- Age UK is a registered charity and company limited by guarantee, (registered charity number 1128267, registered company number 6825798). Registered office: Tavis House, 1-6 Tavistock Square, London WC1H 9NA. For the purposes of promoting Age UK Insurance, Age UK is an Appointed Representative of Age UK Enterprises Limited, Age UK is an Introducer Appointed Representative of JLT Benefit Solutions Limited and Simplyhealth Access for the purposes of introducing potential annuity and health cash plans customers respectively. Age UK Enterprises Limited, JLT Benefit Solutions Limited and Simplyhealth Access are all authorised and regulated by the Financial Services Authority. ------------------------------ This email and any files transmitted with it are confide...{{dropped:31}}
Mark Leeds
2013-Feb-21 15:57 UTC
[R] Arimax with intervention dummy and multiple covariates
Hi: bierens has a paper on modelling beer sales in the netherland ( I'm pretty sure it's on the net. if not, I have a copy somewhere I think ) using an ARIMAX. why don't you take his paper and his data and see if you get the same estimates using R. That's one way if you'll know if you're doing the steps correctly. I don't have cryer and chan and I've never used the TSA package so I can't say anything else. On Thu, Feb 21, 2013 at 5:26 AM, Jose Iparraguirre < Jose.Iparraguirre@ageuk.org.uk> wrote:> Hi > > I'm trying to measure the effect of a policy intervention (Box and Tiao, > 1975). > This query has to do with the coding of the model rather than with the > particulars of my dataset, so I'm not providing the actual dataset (or a > simulated one) in this case, apart from some general description. > > The time series are of length n=34 (annual observations between 1977 and > 2010). The policy measure was introduced in 2000 and it has been > implemented once a year ever since. > > The variable of interest (VI) is continuous, and I have four continuous > covariates (CO1-CO4), plus the dummy intervention variable (DUM) which is > equal to 0 between 1977 and 1999 and equal to 1 since 2000. > > I thought of using an ARIMAX model, with the arimax() function in the TSA > package to fit the transfer function. I'm interested in modelling the > intervention effect as a step function. > > I specified the model thus: > > > a. I've checked the ARIMA properties of each series using the > auto.arima() function (from the 'forecast' package) -the VI was found to > best fit an ARIMA(0,1,1) model and the first covariate an ARIMA(1,0,0), > whereas the other covariates were white noise. > > > > b. To facilitate the specification of the various models (the > different model specifications dropped variables or added additional > covariates, etc, without changing the general structure of the syntax > below), I defined the following design matrix: > > > > > xreg.1 <- model.matrix(~CO1+ CO2+ CO3+ CO4)[,2:5] > > > > c. Following Cryer and Chan (2008, ch. 11, p. 255), I wrote models > such as this: > > > > > arimax.1 <- arimax(VI, order=c(0,1,1), > > + xtransf=data.frame(xreg.1,dummy1=DUM), > > + transfer=list(c(1,0),c(0,0),c(0,0),c(0,0),c(0,0))) > > > d. So, I get estimates for the following coefficients: > > > ma1; CO1-AR1; CO1-MA0; CO2-MA0; CO3-MA0; CO4-MA0; DUM-MA0 > > Can you spot any problems with the general modelling approach or in this > specification? > > Many thanks in advance, > > José > > > > José Iparraguirre > Chief Economist > Age UK > > T 020 303 31482 > E Jose.Iparraguirre@ageuk.org.uk<mailto:Jose.Iparraguirre@ageuk.org.uk> > Twitter @jose.iparraguirre@ageuk > > > Tavis House, 1- 6 Tavistock Square > London, WC1H 9NB > www.ageuk.org.uk<http://www.ageuk.org.uk> | ageukblog.org.uk< > http://ageukblog.org.uk/> | @ageuk<http://twitter.com/ageukpa>campaigns > > Wrap Up and Run 10k is back! > > Also, new for 2013 – 2km intergenerational walks at selected venues. So > recruit a buddy, dust off the trainers and beat the winter blues by > signing up now: > > http://www.ageuk.org.uk/10k > > Milton Keynes | Oxford | Sheffield | Crystal Palace | > Exeter | Harewood House, Leeds | > Tatton Park, Cheshire | Southampton | > Coventry > > > > Age UK Improving later life > > http://www.ageuk.org.uk > > > > > ------------------------------- > Age UK is a registered charity and company limited by guarantee, > (registered charity number 1128267, registered company number 6825798). > Registered office: Tavis House, 1-6 Tavistock Square, London WC1H 9NA. > > For the purposes of promoting Age UK Insurance, Age UK is an Appointed > Representative of Age UK Enterprises Limited, Age UK is an Introducer > Appointed Representative of JLT Benefit Solutions Limited and Simplyhealth > Access for the purposes of introducing potential annuity and health > cash plans customers respectively. Age UK Enterprises Limited, JLT > Benefit Solutions Limited and Simplyhealth Access are all authorised and > regulated by the Financial Services Authority. > ------------------------------ > > This email and any files transmitted with it are confide...{{dropped:31}} > > > ______________________________________________ > R-help@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. > >[[alternative HTML version deleted]]
Mark Leeds
2013-Feb-21 16:38 UTC
[R] Arimax with intervention dummy and multiple covariates
to anyone who was mistakenly looking for the armax beer paper using Bierens as the author. I made a mistake and apologize because the author was franses and the paper is at the link below: http://repub.eur.nl/res/pub/2112/eur_franses_MR1.pdf On Thu, Feb 21, 2013 at 11:23 AM, Paul Bernal <paulbernal07@gmail.com>wrote:> Thank you very much my friend. > El 21/02/2013 11:21, "Mark Leeds" <markleeds2@gmail.com> escribió: > >> let me look. I have hardcopy so hopefully I have computer copy. get back >> in a few minutes. >> >> >> On Thu, Feb 21, 2013 at 11:06 AM, Paul Bernal <paulbernal07@gmail.com>wrote: >> >>> Could you please provide me with a copy of that text? >>> >>> Best regards, >>> >>> Paul >>> El 21/02/2013 10:59, "Mark Leeds" <markleeds2@gmail.com> escribió: >>> >>>> Hi: bierens has a paper on modelling beer sales in the netherland ( I'm >>>> pretty sure it's on the net. >>>> if not, I have a copy somewhere I think ) using an ARIMAX. why don't >>>> you >>>> take his paper and his data and see if you get the same estimates using >>>> R. >>>> That's one way if you'll know if you're doing the steps correctly. I >>>> don't >>>> have cryer and chan and I've never used the TSA package so I can't say >>>> anything else. >>>> >>>> >>>> >>>> >>>> >>>> >>>> On Thu, Feb 21, 2013 at 5:26 AM, Jose Iparraguirre < >>>> Jose.Iparraguirre@ageuk.org.uk> wrote: >>>> >>>> > Hi >>>> > >>>> > I'm trying to measure the effect of a policy intervention (Box and >>>> Tiao, >>>> > 1975). >>>> > This query has to do with the coding of the model rather than with the >>>> > particulars of my dataset, so I'm not providing the actual dataset >>>> (or a >>>> > simulated one) in this case, apart from some general description. >>>> > >>>> > The time series are of length n=34 (annual observations between 1977 >>>> and >>>> > 2010). The policy measure was introduced in 2000 and it has been >>>> > implemented once a year ever since. >>>> > >>>> > The variable of interest (VI) is continuous, and I have four >>>> continuous >>>> > covariates (CO1-CO4), plus the dummy intervention variable (DUM) >>>> which is >>>> > equal to 0 between 1977 and 1999 and equal to 1 since 2000. >>>> > >>>> > I thought of using an ARIMAX model, with the arimax() function in the >>>> TSA >>>> > package to fit the transfer function. I'm interested in modelling the >>>> > intervention effect as a step function. >>>> > >>>> > I specified the model thus: >>>> > >>>> > >>>> > a. I've checked the ARIMA properties of each series using the >>>> > auto.arima() function (from the 'forecast' package) -the VI was found >>>> to >>>> > best fit an ARIMA(0,1,1) model and the first covariate an >>>> ARIMA(1,0,0), >>>> > whereas the other covariates were white noise. >>>> > >>>> > >>>> > >>>> > b. To facilitate the specification of the various models (the >>>> > different model specifications dropped variables or added additional >>>> > covariates, etc, without changing the general structure of the syntax >>>> > below), I defined the following design matrix: >>>> > >>>> > >>>> > >>>> > > xreg.1 <- model.matrix(~CO1+ CO2+ CO3+ CO4)[,2:5] >>>> > >>>> > >>>> > >>>> > c. Following Cryer and Chan (2008, ch. 11, p. 255), I wrote >>>> models >>>> > such as this: >>>> > >>>> > >>>> > >>>> > > arimax.1 <- arimax(VI, order=c(0,1,1), >>>> > >>>> > + xtransf=data.frame(xreg.1,dummy1=DUM), >>>> > >>>> > + transfer=list(c(1,0),c(0,0),c(0,0),c(0,0),c(0,0))) >>>> > >>>> > >>>> > d. So, I get estimates for the following coefficients: >>>> > >>>> > >>>> > ma1; CO1-AR1; CO1-MA0; CO2-MA0; CO3-MA0; CO4-MA0; DUM-MA0 >>>> > >>>> > Can you spot any problems with the general modelling approach or in >>>> this >>>> > specification? >>>> > >>>> > Many thanks in advance, >>>> > >>>> > José >>>> > >>>> > >>>> > >>>> > José Iparraguirre >>>> > Chief Economist >>>> > Age UK >>>> > >>>> > T 020 303 31482 >>>> > E Jose.Iparraguirre@ageuk.org.uk<mailto: >>>> Jose.Iparraguirre@ageuk.org.uk> >>>> > Twitter @jose.iparraguirre@ageuk >>>> > >>>> > >>>> > Tavis House, 1- 6 Tavistock Square >>>> > London, WC1H 9NB >>>> > www.ageuk.org.uk<http://www.ageuk.org.uk> | ageukblog.org.uk< >>>> > http://ageukblog.org.uk/> | @ageuk<http://twitter.com/ageukpa >>>> >campaigns >>>> > >>>> > Wrap Up and Run 10k is back! >>>> > >>>> > Also, new for 2013 – 2km intergenerational walks at selected venues. >>>> So >>>> > recruit a buddy, dust off the trainers and beat the winter blues by >>>> > signing up now: >>>> > >>>> > http://www.ageuk.org.uk/10k >>>> > >>>> > Milton Keynes | Oxford | Sheffield | Crystal Palace | >>>> > Exeter | Harewood House, Leeds | >>>> > Tatton Park, Cheshire | Southampton | >>>> > Coventry >>>> > >>>> > >>>> > >>>> > Age UK Improving later life >>>> > >>>> > http://www.ageuk.org.uk >>>> > >>>> > >>>> > >>>> > >>>> > ------------------------------- >>>> > Age UK is a registered charity and company limited by guarantee, >>>> > (registered charity number 1128267, registered company number >>>> 6825798). >>>> > Registered office: Tavis House, 1-6 Tavistock Square, London WC1H 9NA. >>>> > >>>> > For the purposes of promoting Age UK Insurance, Age UK is an Appointed >>>> > Representative of Age UK Enterprises Limited, Age UK is an Introducer >>>> > Appointed Representative of JLT Benefit Solutions Limited and >>>> Simplyhealth >>>> > Access for the purposes of introducing potential annuity and health >>>> > cash plans customers respectively. Age UK Enterprises Limited, JLT >>>> > Benefit Solutions Limited and Simplyhealth Access are all authorised >>>> and >>>> > regulated by the Financial Services Authority. >>>> > ------------------------------ >>>> > >>>> > This email and any files transmitted with it are >>>> confide...{{dropped:31}} >>>> > >>>> > >>>> > ______________________________________________ >>>> > R-help@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. >>>> > >>>> > >>>> >>>> [[alternative HTML version deleted]] >>>> >>>> >>>> >>>> ______________________________________________ >>>> R-help@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. >>>> >>>> >>[[alternative HTML version deleted]]
Apparently Analagous Threads
- How to delete only those rows in a dataframe in which all records are missing
- qplot with many files (each one curve)
- anova test for variables with different lengths
- Is there a function that runs AR model with Schwarz Bayesian Information Criteria (BIC)?
- error while extracting the p-value from adf.test