Skip to content

When difforder=0, output has it as NULL #12

Description

@grundy95

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:

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.
model.refit$difforder
## [1] 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions