Announcement

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

  • ARIMA Estimation and Prediction

    Hi.

    I work at a fast food chain with around 80 restaurants. We're trying to develop a prediction model for transactions. The database is quite large with over 1.8 million entries. It is data that dates back to 2012 and most importantly it is HOURLY data.

    We've seen that the previous weeks at the same day of the week and hour are strong predictors. For example, Friday's transactions at restaurant #1 at 9AM can be predicted by the previous Fridays at restaurant #1 at 9AM.
    Since the variable depends on some way on itself, an ARIMA model might be a good fit.

    Since I have 80 restaurants over time, it's set up as panel data.
    xtset restaurant timeanddate, delta(3600000)
    The delta is set up like that because the time variable is set up in milliseconds and 3600000 is the number of milliseconds in an hour.

    I need help on setting up the model in STATA.

    I've been doing it sort of manually (by creating temporal lagged variables)
    For example:
    arima y L168.y L336.y L504.y L672.y if restaurant==3

    I have to add the if condition because arima doesn't work without panel data.

    How would I create an arima model that is only arima y, ar(x) ma(y) if restaurant==3

    Also, after estimation I would like to predict the next dates dynamically. (So that it uses the predictions created by the model instead of the actual values)

    I'm an Economics major but have not worked previously with STATA.

    Thanks so much!

    *restaurant==3 was just an example, I need a prediction model for every restaurant.

    Also I've done a regular regression and achieved an R2 of around 75%, however I'm looking to try ARIMA to improve accuracy.

  • #2
    Welcome to Stata and to Statalist!

    Let me mention, in case you've overlooked them, that Stata's panel data commands include several that seemingly address themselves to the issues you are addressing. Look in the "Dynamic panel-data estimators" section of the output of help xt for pointers. These seem to be something more than xtreg if not a panel-by-panel ARIMA, and perhaps are more suitable that building 80 separate, unconnected, ARIMA models. For more detailed information, look in the Stata Longitudinal-Data/Panel-Data Reference Manual (xt.pdf) included as PDFs in the Stata installation (since version 11) and are accessible from within Stata - for example, through Stata's Help menu.

    I wrote "seemingly" above because in truth, I've not used them and are aware of them only by virtue of questions asked about them on Statalist. So my apologies if this is really not relevant.

    Perhaps someone more knowledgeable can comment further on these models.

    Comment

    Working...
    X