When using the mlp function and setting difforder=0, the resulting model doesn't include differencing, however, the output indicates the difforder is NULL not 0. This then creates issues when fitting the same model to new data as difforder is set as NULL and not 0.
Please see the code example:
X = rnorm(500)
X = X+seq(0, 10, length.out=500)
model = nnfor::mlp(as.ts(X[1:400]),
xreg = cbind(1:500),
xreg.lags=list(0),
xreg.keep=list(TRUE),
difforder=0)
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
#Model fits without differencing
model
## MLP fit with 5 hidden nodes and 20 repetitions.
## Univariate lags: (2)
## 1 regressor included.
## - Regressor 1 lags: (0)
## Forecast combined using the median operator.
## MSE: 1.0234.
# However, difforder is NULL
model$difforder
## NULL
model.refit = nnfor::mlp(as.ts(X),
model=model,
xreg = cbind(1:500),
xreg.lags = list(0),
xreg.keep=list(TRUE),
difforder=0)
#Model now includes differencing
model.refit
## MLP fit with 5 hidden nodes and 20 repetitions.
## Series modelled in differences: D1.
## Univariate lags: (2)
## 1 regressor included.
## - Regressor 1 lags: (0)
## Forecast combined using the median operator.
## MSE: 6.9452.
Hi,
When using the mlp function and setting difforder=0, the resulting model doesn't include differencing, however, the output indicates the difforder is NULL not 0. This then creates issues when fitting the same model to new data as difforder is set as NULL and not 0.
Please see the code example: