NNS.ARMA.optim: NNS ARMA Optimizer

Description Usage Arguments Value Note Author(s) References Examples

View source: R/ARMA_optim.R

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
NNS.ARMA.optim(
  variable,
  training.set,
  seasonal.factor,
  negative.values = FALSE,
  obj.fn = expression(sum((predicted - actual)^2)),
  objective = "min",
  linear.approximation = TRUE,
  lin.only = FALSE,
  print.trace = TRUE,
  ncores = NULL
)

Arguments

variable

a numeric vector.

training.set

integer; 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).

obj.fn

expression; expression(sum((predicted - actual)^2)) (default) 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") "min" (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.

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!

ncores

integer; value specifying the number of cores to be used in the parallelized procedure. If NULL (default), the number of cores to be used is equal to half the number of cores of the machine.

Value

Returns a list containing:

Note

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## 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))

## Then 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)

## End(Not run)

NNS documentation built on June 26, 2021, 1:07 a.m.