Announcement

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

  • Using ARIMA MA(1) Results to Reproduce Predicted Values

    Hi All,

    I have used the attached data to estimate an ARIMA MA(1) model using the following code (data are weekly paper towel sales):
    Code:

    use "t9-1 towel.dta", clear rename y sales generate time = _n tsset time arima sales, arima(0 1 1) predict psales, y predict pD_sales, xb predict resids, residuals generate D_sales = D.sales
    The results from the ARIMA MA(1) model are (attached below, too):



    My question is how to use the results to reproduce the predicted values for sales (psales) and/or the predicted values for the first differences of sales (pD_sales)?

    The first four observations of the data are also attached:



    As you can see, the predicted value for the first difference of sales for the 4th time period is .2535219.

    How can I use Stata output to reproduce these results?

    I thought that the value of the predicted first difference of the 4th observation should be equal to a constant plus the current error plus the MA(1) parameter times the previous error. For example,

    .00577 + .8455773 + .3518248*.7137719 = 1.1025

    I can see that this is close to the actual value of the first difference of sales equal to 1.099099.

    I am teaching myself time series analysis, so please pardon my rudimentary question.

    Again, I have attached the data, output of my ARIMA(0 1 1) model, and a list of the first 4 observations.

    Cheers,
    Adam
    Attached Files

  • #2
    Use the predict command. See help arima postestimation.
    Jorge Eduardo Pérez Pérez
    www.jorgeperezperez.com

    Comment


    • #3
      Hi Jorge,

      My original post's code was inputted correctly. I'm including it here using the forum's code parser:

      Code:
      "t9-1 towel.dta", clear
      rename y sales
      generate time = _n
      tsset time arima sales, arima(0 1 1)
      predict psales, y
      predict pD_sales, xb
      predict resids, residuals
      ​generate D_sales = D.sales
      As you can see using the output above, the result from Stata's predict command for the 4th observation's first difference is .2535 (results above).

      My question has to do with reproducing this value using the Stata output from the ARIMA model (e.g., the maL1. coefficient equal to .3518, etc.).

      Do you know how to do this?

      Thanks so much for your first response.

      Adam

      Comment


      • #4
        Computing the prediction as

        Code:
        generate prediction = _b[_cons] 
        replace prediction = [ARMA]_b[L.ma]*(l.d.sales - l.prediction) + _b[_cons] in 3/l
        produces the same results as predict for latter points in the sample, but not for earlier ones, so my guess is that the discrepancy is due to the way Stata handles the initial values of the innovations. Someone else may be able to clarify.
        Jorge Eduardo Pérez Pérez
        www.jorgeperezperez.com

        Comment


        • #5
          Thank you so much for your response, Jorge, this does answer my question. It didn't occur to me to write a line of code for every observation's predicted value to examine deviations from one to then next, this versus just experimenting with one at a time, so thank your for the programming tip, too!

          Cheers,
          Adam Guerrero

          Comment

          Working...
          X