I have traffic data from cars on a roadside view for 3 weeks Each line of data sets consists of Day, Time, and Track number of cars for 3 weeks. I want to make a forecast for the 4th week using these data and using the ARIMA model

Here is an example of my data

Time          Data 
2008-05-19-00 110 
2008-05-19-01 25 
2008-05-19-02 900 
2008-05-19-03 434 
2008-05-19-04 50

Until 2008-06-08

How do I make a forecast of the 4th week (from 9/06 to 15/06)?

  • 1
    $\begingroup$ Who can help me please? $\endgroup$ – Rami Apr 22 '17 at 12:47

Here, you can use this cheat sheet for ARIMA.(https://www.datascience.com/blog/introduction-to-forecasting-with-arima-in-r-learn-data-science-tutorials)

  1. Examine your data

Plot the data and examine its patterns and irregularities.

Clean up any outliers or missing values if needed. tsclean() is a convenient method for outlier removal and inputing missing values.

Take a logarithm of a series to help stabilize a strong growth trend.

  1. Decompose your data

Does the series appear to have trends or seasonality?

Use decompose() or stl() to examine and possibly remove components of the series.

  1. Stationarity

Is the series stationary?

Use adf.test(), ACF, PACF plots to determine order of differencing needed.

  1. Autocorrelations and choosing model order

Choose order of the ARIMA by examining ACF and PACF plots

  1. Fit an ARIMA model
  2. Evaluate and iterate

Check residuals, which should haven no patterns and be normally distributed If there are visible patterns or bias, plot ACF/PACF. Are any additional order parameters needed? Refit model if needed. Compare model errors and fit criteria such as AIC or BIC. Calculate forecast using the chosen model.

As the others mentioned, you can use "forecast" package after your model is built.


You can make use of the "forecast" package in R. However, you will have to fita model before doing that.

example code:

model <- auto.arima(Data)
  • $\begingroup$ I do not need to introduce some parameters, that is to say is all pass automatically? $\endgroup$ – Rami Apr 22 '17 at 13:33
  • $\begingroup$ You can't forecast without modelling first. Otherwise your predictions will be random. the auto.arima function fits an ARIMA model automatically. You can then take a look using the summary() function $\endgroup$ – Vasilis Vasileiou Apr 22 '17 at 13:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.