# NNS.ARMA.optim: NNS ARMA Optimizer In NNS: Nonlinear Nonparametric Statistics

 NNS.ARMA.optim R Documentation

## NNS ARMA Optimizer

### Description

Wrapper function for optimizing any combination of a given `seasonal.factor` vector in NNS.ARMA. Minimum sum of squared errors (forecast-actual) is used to determine optimum across all NNS.ARMA methods.

### Usage

```NNS.ARMA.optim(
variable,
h = NULL,
training.set = NULL,
seasonal.factor,
negative.values = FALSE,
obj.fn = expression(cor(predicted, actual, method = "spearman")/sum((predicted -
actual)^2)),
objective = "max",
linear.approximation = TRUE,
lin.only = FALSE,
conf.intervals = NULL,
print.trace = TRUE
)
```

### Arguments

 `variable` a numeric vector. `h` integer; `NULL` (default) Number of periods to forecast out of sample. If `NULL`, `h = length(variable) - training.set`. `training.set` integer; `NULL` (default) Sets the number of variable observations as the training set. See `Note` below for recommended uses. `seasonal.factor` integers; Multiple frequency integers considered for NNS.ARMA model, i.e. `(seasonal.factor = c(12, 24, 36))` `negative.values` logical; `FALSE` (default) If the variable can be negative, set to `(negative.values = TRUE)`. It will automatically select `(negative.values = TRUE)` if the minimum value of the `variable` is negative. `obj.fn` expression; `expression(cor(predicted, actual, method = "spearman") / sum((predicted - actual)^2))` (default) Rank correlation / sum of squared errors is the default objective function. Any `expression()` using the specific terms `predicted` and `actual` can be used. `objective` options: ("min", "max") `"max"` (default) Select whether to minimize or maximize the objective function `obj.fn`. `linear.approximation` logical; `TRUE` (default) Uses the best linear output from `NNS.reg` to generate a nonlinear and mixture regression for comparison. `FALSE` is a more exhaustive search over the objective space. `lin.only` logical; `FALSE` (default) Restricts the optimization to linear methods only. `conf.intervals` numeric [0, 1]; `NULL` Returns the associated confidence intervals for the final estimate. Constructed using the maximum entropy bootstrap meboot on the final estimates. `print.trace` logical; `TRUE` (defualt) Prints current iteration information. Suggested as backup in case of error, best parameters to that point still known and copyable!

### Value

Returns a list containing:

• `\$period` a vector of optimal seasonal periods

• `\$weights` the optimal weights of each seasonal period between an equal weight or NULL weighting

• `\$obj.fn` the objective function value

• `\$method` the method identifying which NNS.ARMA method was used.

• `\$shrink` whether to use the `shrink` parameter in NNS.ARMA.

• `\$bias.shift` a numerical result of the overall bias of the optimum objective function result. To be added to the final result when using the NNS.ARMA with the derived parameters.

• `\$errors` a vector of model errors from internal calibration.

• `\$results` a vector of length `h`.

• `\$lower.conf.int` a vector of lower confidence intervals per forecast point.

• `\$upper.conf.int` a vector of upper confidence intervals per forecast point.

### Note

• Typically, `(training.set = length(variable) - 2 * length(forecast horizon))` is used for optimization. Smaller samples would use `(training.set = length(variable) - length(forecast horizon))` in order to preserve information.

• The number of combinations will grow prohibitively large, they should be kept as small as possible. `seasonal.factor` containing an element too large will result in an error. Please reduce the maximum `seasonal.factor`.

• If variable cannot logically assume negative values, then the `\$bias.shift` must be limited to 0 via a `pmax(0,...)` call.

### Author(s)

Fred Viole, OVVO Financial Systems

### References

Viole, F. and Nawrocki, D. (2013) "Nonlinear Nonparametric Statistics: Using Partial Moments" https://www.amazon.com/dp/1490523995/ref=cm_sw_su_dp

### Examples

```
## Nonlinear NNS.ARMA period optimization using 2 yearly lags on AirPassengers monthly data
## Not run:
nns.optims <- NNS.ARMA.optim(AirPassengers[1:132], training.set = 120,
seasonal.factor = seq(12, 24, 6))

## To use optimal parameters in NNS.ARMA to predict 12 periods in-sample.
## Note the {\$bias.shift} usage in the {NNS.ARMA} function:
nns.estimates <- NNS.ARMA(AirPassengers, h = 12, training.set = 132,
seasonal.factor = nns.optims\$periods, method = nns.optims\$method) + nns.optims\$bias.shift

## If variable cannot logically assume negative values
nns.estimates <- pmax(0, nns.estimates)

## To predict out of sample using best parameters:
NNS.ARMA.optim(AirPassengers[1:132], h = 12, seasonal.factor = seq(12, 24, 6))

## End(Not run)

```

NNS documentation built on Nov. 4, 2022, 1:06 a.m.