forecast icon indicating copy to clipboard operation
forecast copied to clipboard

multivariate nnetar

Open gabrielcaceres opened this issue 8 years ago • 3 comments

Would you be interested in having nnetar being able to jointly fit/forecast multiple time series? (essentially turning it into "nnetVar" to do vector autoregression)

nnet can already handle multiple outputs, so that should be quite straightforward. The only tricky part might be making sure none of the internals of nnetar break when a matrix instead of a vector is being used to create lags, forecast, etc.

gabrielcaceres avatar Mar 30 '16 19:03 gabrielcaceres

Yes. This would be a useful addition. I imagine you would want all of the inputs used in each of the univariate models to be available to each output in the multivariate case. We now have some facilities for multivariate forecasting with the mforecast class, so forecast.nnetar() should return something of class "mforecast" if there is more than one series. Existing functions that return that class are forecast.mlm and forecast.varest

robjhyndman avatar Apr 06 '16 02:04 robjhyndman

I'm not sure I completely follow what you mean regarding the inputs... but if I understand correctly, it should automatically be taken care of since all the inputs and outputs are actually connected in a single network.

There are aspects a multivariate neural network model that are more intrinsically tied together than in regular multivariate regression. The extra output neuron has its own independent parameters (as in multivariate regression), but the coefficients of hidden-layer neurons are shared and jointly estimated for both outputs. In a way, the the hidden-layer parameters are estimated on the pooled data (using all of the available inputs), while the output neurons independently model each series (using the hidden-layer outputs).

gabrielcaceres avatar Apr 07 '16 01:04 gabrielcaceres

OK. Thanks for the explanation. I haven't fitted multiple output ANNs before so I wasn't sure how the input/output relationships worked.

robjhyndman avatar Apr 07 '16 01:04 robjhyndman