| Title: | Automatic ARIMA Order Selection Using Spider Monkey Optimization |
|---|---|
| Description: | Implements automatic autoregressive integrated moving average order selection using the Spider Monkey Optimization algorithm. Candidate orders are evaluated using a weighted objective function that combines the Akaike information criterion and root mean square error. Functions support model fitting, forecasting, and forecast accuracy evaluation. |
| Authors: | Santosha Rathod [aut], Mrinmoy Ray [aut, cre], Chiranjit Mazumder [aut], Vishnu Shankar [aut], Fasila K. P. [aut], Sujith Arokiaswamy B. [aut], Anil Kumar [aut] |
| Maintainer: | Mrinmoy Ray <[email protected]> |
| License: | GPL-3 |
| Version: | 0.1.1 |
| Built: | 2026-10-06 10:58:18 UTC |
| Source: | https://github.com/cran/SMOARIMA |
The accuracy_smo function computes forecast accuracy measures
for a fitted SMO-ARIMA model using the observed values of the test
series and the corresponding forecasts.
accuracy_smo( object, test )accuracy_smo( object, test )
object |
An object of class |
test |
A univariate test time series ( |
The accuracy_smo function compares the forecasts generated by
the fitted SMO-ARIMA model with the observed test data and computes
commonly used forecast accuracy measures. The function returns Mean
Absolute Error (MAE), Mean Absolute Percentage Error (MAPE), Mean
Squared Error (MSE), Root Mean Square Error (RMSE), and Mean Absolute
Scaled Error (MASE).
MAE |
Mean Absolute Error. |
MAPE |
Mean Absolute Percentage Error. |
MSE |
Mean Squared Error. |
RMSE |
Root Mean Square Error. |
MASE |
Mean Absolute Scaled Error. |
AIC |
Akaike information criterion of the fitted model. |
BIC |
Bayesian information criterion of the fitted model. |
Hyndman, R. J. and Koehler, A. B. (2006). Another look at measures of forecast accuracy. International Journal of Forecasting, 22(4), 679–688.
fit_smo, forecast_smo
data(AirPassengers) fit <- fit_smo( AirPassengers, population = 4, groups = 2, max.iter = 2, p.max = 1, d.max = 1, q.max = 1, local.limit = 2, global.limit = 2 ) acc <- accuracy_smo( fit, fit$test ) accdata(AirPassengers) fit <- fit_smo( AirPassengers, population = 4, groups = 2, max.iter = 2, p.max = 1, d.max = 1, q.max = 1, local.limit = 2, global.limit = 2 ) acc <- accuracy_smo( fit, fit$test ) acc
The fit_smo function automatically identifies the optimal
ARIMA (p, d, q) model using the Spider Monkey Optimization (SMO)
algorithm. The selected model is fitted to the input time series and
returned as an object of class "smoarima".
fit_smo( data, population = 30, groups = 5, max.iter = 80, p.max = 3, d.max = 2, q.max = 3, alpha = 0.7, local.limit = 10, global.limit = 15, train.prop = 0.80, seed = 42 )fit_smo( data, population = 30, groups = 5, max.iter = 80, p.max = 3, d.max = 2, q.max = 3, alpha = 0.7, local.limit = 10, global.limit = 15, train.prop = 0.80, seed = 42 )
data |
Input univariate time series ( |
population |
Population size of the Spider Monkey Optimization algorithm. Default is 30. |
groups |
Number of spider monkey groups. Default is 5. |
max.iter |
Maximum number of optimization iterations. Default is 80. |
p.max |
Maximum autoregressive (AR) order. Default is 3. |
d.max |
Maximum differencing order. Default is 2. |
q.max |
Maximum moving average (MA) order. Default is 3. |
alpha |
Weight assigned to the normalized AIC in the objective function.
The remaining weight (1- |
local.limit |
Maximum number of consecutive non-improving iterations allowed for a local leader before the corresponding group is reinitialized. Default is 10. |
global.limit |
Maximum number of consecutive non-improving iterations allowed for the global leader before group membership is reorganized. Default is 15. |
train.prop |
Proportion of observations assigned to the training sample used for model estimation during order selection. It must be strictly between 0 and 1. Default is 0.80. |
seed |
Random seed for reproducibility. Default is 42. |
The Spider Monkey Optimization (SMO) algorithm searches for the optimal ARIMA order (p,d,q) by minimizing a weighted objective function based on normalized Akaike Information Criterion (AIC) and Root Mean Square Error (RMSE).
model |
Fitted ARIMA model. |
order |
Selected ARIMA order (p,d,q). |
coefficients |
Estimated ARIMA coefficients. |
fitted |
Fitted values. |
residuals |
Model residuals. |
AIC |
Akaike Information Criterion. |
BIC |
Bayesian Information Criterion. |
logLik |
Log-likelihood of the fitted model. |
runtime |
Execution time (seconds). |
convergence |
Optimization convergence history. |
Bansal, J. C., Sharma, H., Jadon, S. S. and Clerc, M. (2014). Spider Monkey Optimization Algorithm for Numerical Optimization. Memetic Computing, 6, 31–47.
Box, G. E. P., Jenkins, G. M., Reinsel, G. C. and Ljung, G. M. (2016). Time Series Analysis: Forecasting and Control. 5th Edition. Wiley.
accuracy_smo, forecast_smo
data(AirPassengers) fit <- fit_smo( data = AirPassengers, population = 4, groups = 2, max.iter = 2, p.max = 1, d.max = 1, q.max = 1, local.limit = 2, global.limit = 2 ) fit$order fit$AICdata(AirPassengers) fit <- fit_smo( data = AirPassengers, population = 4, groups = 2, max.iter = 2, p.max = 1, d.max = 1, q.max = 1, local.limit = 2, global.limit = 2 ) fit$order fit$AIC
The forecast_smo function generates forecasts from a fitted
SMO-ARIMA model obtained using the fit_smo function. Point
forecasts together with the corresponding prediction intervals are
returned for the specified forecast horizon.
forecast_smo( object, h = 10, level = c(80, 95) )forecast_smo( object, h = 10, level = c(80, 95) )
object |
An object of class |
h |
Forecast horizon. Default is 10. |
level |
Confidence level(s) for prediction intervals.
Default is |
The forecast_smo function generates forecasts from the fitted
ARIMA model selected using the Spider Monkey Optimization (SMO)
algorithm. Forecasts are produced for the specified forecast horizon,
along with lower and upper prediction intervals corresponding to the
requested confidence level(s).
method |
Forecasting method used. |
model |
Fitted SMO-ARIMA model. |
mean |
Point forecasts. |
lower |
Lower prediction limits. |
upper |
Upper prediction limits. |
level |
Confidence level(s) used for prediction intervals. |
Hyndman, R. J. and Athanasopoulos, G. (2021). Forecasting: Principles and Practice. 3rd Edition. OTexts, Melbourne, Australia.
fit_smo, accuracy_smo
data(AirPassengers) fit <- fit_smo( AirPassengers, population = 4, groups = 2, max.iter = 2, p.max = 1, d.max = 1, q.max = 1, local.limit = 2, global.limit = 2 ) fc <- forecast_smo( fit, h = 12, level = c(80, 95) ) fc plot(fc)data(AirPassengers) fit <- fit_smo( AirPassengers, population = 4, groups = 2, max.iter = 2, p.max = 1, d.max = 1, q.max = 1, local.limit = 2, global.limit = 2 ) fc <- forecast_smo( fit, h = 12, level = c(80, 95) ) fc plot(fc)