# Using TimeSeriesForecast for forecasting the traffic growth

Have a look to the real traffic growth data (link) of a this website. I was thinking to use Mathematica to do a TimeSeriesForecast and plot the forecast.

Can you help me?

• Any suggestion? Mar 16, 2015 at 14:12
• Is your problem in getting the data from the Google spreadsheet into Mathematica, or is your problem in the use of TimeSeriesForecast on the imported data? Mar 20, 2015 at 18:35
• @celtschk: Copying the data from Excel / Google is already a problem. I've never used Mathematica with external data. Mar 23, 2015 at 11:44
• What Time Series Processes do you want to use for the forecast? Mar 25, 2015 at 20:34
• @Karsten7.: that's a very good question. I'm not very skilled on this part of Mathematica, I've just started to study it. I was thinking to use TimeSeriesModelFit do you think it would fit? Mar 26, 2015 at 10:14

I downloaded the data from the link in your post in TSV format.
Importing and preprocessing the data

data = MapAt[DateString[{#, {"Day", "/", "Month", "/", "Year"}}] &,
Import["D:\\Analytics www.superinformati.com Panoramica del pubblico 20141201-20150303 - Sheet 1.tsv"][[3 ;;, {1, 2}]]
, {All, 1}]


Doing the TimeSeriesModelFit without specifying a process.

tsm = TimeSeriesModelFit[data]


Plotting the time series together with a 30 day forecast.

DateListPlot[{tsm["TemporalData"], TimeSeriesForecast[tsm, {30}]}]


Without a specified process TimeSeriesModelFit choose a SARIMAProcess. A similar process but without seasonality is the ARIMAProcess process.

tsm2 = TimeSeriesModelFit[data, "ARIMA"]


DateListPlot[{tsm2["TemporalData"], TimeSeriesForecast[tsm2, {30}]}]


To get the forecast for one year as a function on can use

fsfFunc = TimeSeriesForecast[tsm2, {365}]["PathFunction"]

fsfFunc[AbsoluteTime@{2016, 1, 1}]


187.706

• It's really really cool, thanks a lot. Is it possible also to have a longer forecast, like in 1 year? Or having the equation of the asymptotic line given in the last image? Mar 26, 2015 at 11:25
• To get the forecast for one year you just have to change the number of time steps ahead to 356 (see). Mar 26, 2015 at 11:32
• Thanks a lot! Just a last question.. is it possible also to get the unseasonalized data graph for the data instead that only for the forecast? See mathematica.stackexchange.com/questions/78279/… Mar 26, 2015 at 11:35
• @Revious See my last comment and the edit. These should answer your question. If you want a linear function that approximates the forecast, just do a fit to TimeSeriesForecast[tsm2, {365}]["Path"]. Mar 26, 2015 at 11:42
• Thanks and congratulations for your skill on Mathematica! Mar 26, 2015 at 11:47