2
$\begingroup$

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?

enter image description here

$\endgroup$
  • $\begingroup$ Any suggestion? $\endgroup$ – Revious Mar 16 '15 at 14:12
  • 1
    $\begingroup$ 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? $\endgroup$ – celtschk Mar 20 '15 at 18:35
  • $\begingroup$ @celtschk: Copying the data from Excel / Google is already a problem. I've never used Mathematica with external data. $\endgroup$ – Revious Mar 23 '15 at 11:44
  • 1
    $\begingroup$ What Time Series Processes do you want to use for the forecast? $\endgroup$ – Karsten 7. Mar 25 '15 at 20:34
  • $\begingroup$ @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? $\endgroup$ – Revious Mar 26 '15 at 10:14
2
$\begingroup$

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]

enter image description here

Plotting the time series together with a 30 day forecast.

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

enter image description here

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

tsm2 = TimeSeriesModelFit[data, "ARIMA"]

enter image description here

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

enter image description here

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

$\endgroup$
  • $\begingroup$ 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? $\endgroup$ – Revious Mar 26 '15 at 11:25
  • 1
    $\begingroup$ To get the forecast for one year you just have to change the number of time steps ahead to 356 (see). $\endgroup$ – Karsten 7. Mar 26 '15 at 11:32
  • $\begingroup$ 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/… $\endgroup$ – Revious Mar 26 '15 at 11:35
  • 1
    $\begingroup$ @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"]. $\endgroup$ – Karsten 7. Mar 26 '15 at 11:42
  • $\begingroup$ Thanks and congratulations for your skill on Mathematica! $\endgroup$ – Revious Mar 26 '15 at 11:47

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.