| NNS.ARMA.optim {NNS} | 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(mean((predicted - actual)^2)/(NNS::Co.LPM(1, predicted, actual,
target_x = mean(predicted), target_y = mean(actual)) + NNS::Co.UPM(1, predicted,
actual, target_x = mean(predicted), target_y = mean(actual)))),
objective = "min",
linear.approximation = TRUE,
pred.int = 0.95,
print.trace = TRUE,
plot = FALSE
)
Arguments
variable |
a numeric vector. |
h |
integer; |
training.set |
integer; |
seasonal.factor |
integers; Multiple frequency integers considered for NNS.ARMA model, i.e. |
negative.values |
logical; |
obj.fn |
expression;
|
objective |
options: ("min", "max") |
linear.approximation |
logical; |
pred.int |
numeric [0, 1]; 0.95 (default) Returns the associated prediction intervals for the final estimate. Constructed using the maximum entropy bootstrap NNS.meboot on the final estimates. |
print.trace |
logical; |
plot |
logical; |
Value
Returns a list containing:
$perioda vector of optimal seasonal periods$weightsthe optimal weights of each seasonal period between an equal weight or NULL weighting$obj.fnthe objective function value$methodthe method identifying which NNS.ARMA method was used.$shrinkwhether to use theshrinkparameter in NNS.ARMA.$nns.regresswhether to smooth the variable via NNS.reg before forecasting.$bias.shifta 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.$errorsa vector of model errors from internal calibration.$resultsa vector of lengthh.$lower.pred.inta vector of lower prediction intervals per forecast point.$upper.pred.inta vector of upper prediction intervals per forecast point.
Note
Typically,
(training.set = 0.8 * length(variable)is used for optimization. Smaller samples could use(training.set = 0.9 * length(variable))(or larger) in order to preserve information.The number of combinations will grow prohibitively large, they should be kept as small as possible.
seasonal.factorcontaining an element too large will result in an error. Please reduce the maximumseasonal.factor.
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 predict out of sample using best parameters:
NNS.ARMA.optim(AirPassengers[1:132], h = 12, seasonal.factor = seq(12, 24, 6))
## Incorporate any objective function from external packages (such as \code{Metrics::mape})
NNS.ARMA.optim(AirPassengers[1:132], h = 12, seasonal.factor = seq(12, 24, 6),
obj.fn = expression(Metrics::mape(actual, predicted)), objective = "min")
## End(Not run)