which is the appropriate neuronal network / function for time series prediction? Please consider, that above example is just a simplified data-example.
Well, this totally depends on your data. In your example data you have
- a small univariate time series (only 14 observations)
- a linear trend
- no white noise
- no seasonality
- no cycle
- non non-linearity
nnetar()
Neural networks are generally very data savvy/ data hungry. That means that you need a lot of data to implement an accurate forecast. 14 observations are definitely not enough you rather need some ten or hundred thousands. In general, I do not recommend using neural networks for forecasting univariate time series. One benefit of neural networks is that they can capture nonlinearities, but your data does not exhibit any nonlinearity. Note that nnetar()
uses a feed-forward neural network; in recent time series forecasting many researchers use recurrent neural networks instead of feed-forward neural networks.
You can also read this discussion. As far as I know nnetar()
is based on the discussion here
If you print fit
you will see the model. It is an average of 20 different neural networks and therefore not deterministic.
Series: df
Model: NNAR(1,1)
Call: nnetar(y = df)
Average of 20 networks, each of which is
a 1-1-1 network with 4 weights
options were - linear output units
sigma^2 estimated as 0.003636
ets()
This function uses exponential smoothing. Exponential smoothing models require fewer parameters. Therefore they perform better on your tiny dataset.
It might help to have a closer look at the equations of simple exponential smoothing:
$s_0 = x_0$
$s_t = \alpha x_t + (1- \alpha) s_{t-1}$
In your case $s_0$ and $x_0$ are 0.
If you print fit2
you can see that the information criteria are all equal to minus infinity which states that there is no better model than the one you have chosen.
ETS(A,A,N)
Call:
ets(y = df)
Smoothing parameters:
alpha = 0.5445
beta = 0.1009
Initial states:
l = 0
b = 1
sigma: 0
AIC AICc BIC
-Inf -Inf -Inf