Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • ARIMA and inconsistent results when differencing for stationarity

    Hi,

    I am exploring the options for the -arima- command for an interrupted time series and noticed that different results are obtained depending on whether the differencing is done manually or within the -arima- command.

    Using the sample data: "http://www.stata-press.com/data/r16/wpi1.dta", the two simple models below produce identical results:

    * Model 1 - Differencing within arima
    arima wpi, arima(1,1,4)


    * Model 2 - Use already differenced variable in the model and set i = 0
    generate d1_wpi = d1.wpi
    arima d1_wpi, arima(1,0,4)

    However, when I include a variable in the model to represent the introduction of an policy (for an interrupted time series) the two approaches estimate different coefficients for policy:

    *** Create a policy variable - 1 from 1981 and 0 before then
    g year = yofd(dofq(t))
    g policy = 0
    recode policy (0=1) if year>=1981

    *Model 1
    arima wpi policy, arima(1,1,4) // coefficient = 0.88 (p = 0.64)

    *Model 2
    arima d1_wpi policy, arima(1,0,4) //coefficient = 0.08 (p = 0.88)

    Can anyone suggest why the models differ and how I should proceed?

  • #2
    If you specify a lower order of integration, you need to difference all variables involved. So

    arima wpi policy, arima(1,1,4)
    is equivalent to

    Code:
    tsset year
    arima d.wpi d.policy, arima(1,0,4)

    Comment


    • #3
      Thanks Andrew Musau - so if I need to difference the outcome to render it stationary, all IVs will also need to be differenced, is that correct? Is this so that the impact of the introduction of the policy still matches its introduction (in my example quarter 1 of 1981)?

      Also I am unsure if nocons should be specified once detrended - could you advise?
      Last edited by Jen Ward; 27 Aug 2021, 03:58.

      Comment


      • #4
        so if I need to difference the outcome to render it stationary, all IVs will also need to be differenced, is that correct?
        The command allows you to specify only one order of integration. This allows consistency in the interpretation of coefficients. Do you have a case where the outcome has a unit root and the independent variable is stationary at levels?


        Also I am unsure if nocons should be specified once detrended - could you advise?
        If you difference a series only once, the assumption is that the original series has a constant average trend (e.g., a random walk). Therefore, you can include -nocons- after differencing if you want to allow a non-zero average trend in the series.

        Comment


        • #5
          Hi Andrew Musau , thanks again for your reply. I am very new to time series analysis and I must admit, having looked at online resources, that I had focused on exploring the outcome to check for stationarity as well as MA and AR but I had not considered the same should be done for the IVs. With binary IVs, which capture policy introduction as a step function, I am assuming that's also technically not stationary?

          I have a question re. what you said:

          If you difference a series only once, the assumption is that the original series has a constant average trend (e.g., a random walk). Therefore, you can include -nocons- after differencing if you want to allow a non-zero average trend in the series
          Would you say including -nocons- is a good assumption and better estimate of the IV? is it similar to capturing a drift?

          Could you point me to any resource?

          Comment


          • #6
            My apologies, the statement should have read you include a constant if you want to assume that the series has a constant average trend. Here is a silly example. If we run arima with no autoregressive and moving average terms and no differencing, the reported constant is just the mean of the series.

            Code:
            webuse wpi1, clear
            arima wpi, arima(0,0,0)
            mean wpi
            Res.:

            Code:
            . arima wpi, arima(0,0,0)
            
            (setting optimization to BHHH)
            Iteration 0:   log likelihood = -598.19748  
            Iteration 1:   log likelihood = -598.19748  
            
            ARIMA regression
            
            Sample:  1960q1 - 1990q4                        Number of obs     =        124
                                                            Wald chi2(.)      =          .
            Log likelihood = -598.1975                      Prob > chi2       =          .
            
            ------------------------------------------------------------------------------
                         |                 OPG
                     wpi |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
            -------------+----------------------------------------------------------------
            wpi          |
                   _cons |   62.77419   3.078078    20.39   0.000     56.74127    68.80712
            -------------+----------------------------------------------------------------
                  /sigma |   30.12136   4.769445     6.32   0.000     20.77342     39.4693
            ------------------------------------------------------------------------------
            Note: The test of the variance against zero is one sided, and the two-sided
                  confidence interval is truncated at zero.
            
            .
            . mean wpi
            
            Mean estimation                   Number of obs   =        124
            
            --------------------------------------------------------------
                         |       Mean   Std. Err.     [95% Conf. Interval]
            -------------+------------------------------------------------
                     wpi |   62.77419   2.715952      57.39813    68.15025
            --------------------------------------------------------------
            
            .
            If we difference once, the reported constant is the mean of the differenced series

            Code:
            webuse wpi1, clear
            arima wpi, arima(0,1,0)
            gen dwpi= d.wpi
            mean dwpi
            Res.:

            Code:
            . arima wpi, arima(0,1,0)
            
            (setting optimization to BHHH)
            Iteration 0:   log likelihood = -171.53628  
            Iteration 1:   log likelihood = -171.53628  
            
            ARIMA regression
            
            Sample:  1960q2 - 1990q4                        Number of obs     =        123
                                                            Wald chi2(.)      =          .
            Log likelihood = -171.5363                      Prob > chi2       =          .
            
            ------------------------------------------------------------------------------
                         |                 OPG
                   D.wpi |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
            -------------+----------------------------------------------------------------
            wpi          |
                   _cons |   .6951219   .1056506     6.58   0.000     .4880506    .9021933
            -------------+----------------------------------------------------------------
                  /sigma |   .9759591   .0618399    15.78   0.000      .854755    1.097163
            ------------------------------------------------------------------------------
            Note: The test of the variance against zero is one sided, and the two-sided
                  confidence interval is truncated at zero.
            
            . gen dwpi= d.wpi
            (1 missing value generated)
            
            . mean dwpi
            
            Mean estimation                   Number of obs   =        123
            
            --------------------------------------------------------------
                         |       Mean   Std. Err.     [95% Conf. Interval]
            -------------+------------------------------------------------
                    dwpi |   .6951219   .0883592      .5202061    .8700377
            --------------------------------------------------------------
            
            .
            We difference a series once to make it stationary if the original series has a constant average trend, one example being a random walk. So without differencing, the presence of a constant allows for a non-zero mean in the series. If we difference once, it allows for a non-zero average trend in the series. Duke has some nice online notes on Arima models which you can find at the link below:

            https://people.duke.edu/~rnau/411arim.htm

            The relevant discussion involving differencing and the inclusion of a constant is under "Identifying the order of differencing in an ARIMA model". It is a while since I did anything with time-series models, so I have no favorite textbooks. You may find recommendations on the Duke site.
            Last edited by Andrew Musau; 31 Aug 2021, 06:33.

            Comment


            • #7
              Thanks for the links Andrew Musau

              Comment


              • #8
                Andrew Musau is there any Stata command which would allow me to include an AR and/or MA terms in a regression model? The 'introduction to time series' manual mentions -newey- but it seems to only be able to account for AR. I am interested in this as I would also be interested in modelling the trend (to establish whether linear or quadratic) and I don't think I can do this using -arima- .

                Comment


                • #9
                  arima can fit an ARIMAX model but I do not know of a command that can fit a regression model with ARMA errors, where the difference is described in the following blog post:

                  https://robjhyndman.com/hyndsight/arimax/

                  You can start a new thread, maybe someone knows of a command. If no luck, try R.

                  Comment

                  Working...
                  X