-1
$\begingroup$

Please give a simple example of how to represent data for multivariate (vector) time series in Mathematica, so to use TimeSeriesModelFit?

$\endgroup$
2
$\begingroup$

Multivariate support for TimeSeriesModelFit is not currently implemented (version 10.4.1.).

Here is a way to generate multi-variate data using the first, single variable example in the function page of TimeSeriesModelFit.

data = {5., 9., 8., 10., 6.1, 10.4, 9.1, 11.6, 7.5, 12.1, 10.4, 13.5, 
   9., 14.1, 11.9, 15.7, 10.8, 16.4, 13.7, 18.3, 12.9, 19., 15.8, 21.2,
   15.3, 22.1, 18.3, 24.6};

data = Transpose[{Range[Length[data]], data, 
   data + RandomReal[2, Length[data]]}]

ts = TimeSeries[data[[All, 2 ;; 3]], {data[[All, 1]]}]

ListLinePlot[ts, PlotTheme -> "Detailed"]

enter image description here

TimeSeriesModelFit[ts]

TimeSeriesModelFit::mvtsni: The data TimeSeries[...] is not scalar-valued. Multivariate support is not currently implemented. >>

Of course we can do the model fit separately for each of the time series.

mts = With[{p = ts["Path"]}, 
   Map[TimeSeries[#, {p[[All, 1]]}] &, Transpose@p[[All, 2]]]];

tmodels = TimeSeriesModelFit /@ mts;

Table[ListLinePlot[{mts[[i]], TimeSeriesForecast[tmodels[[i]], {10}]},
   PlotTheme -> "Detailed"], {i, Length[mts]}]

enter image description here

$\endgroup$

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.