R/intermittent_ata.r
intermittentATA.Rd
Intermittent Ata Method is based on Croston's (1972) <doi:10.2307/3007885> method for intermittent demand forecasting, also described in Shenstone and Hyndman (2005) <doi:10.1002/for.963>. Croston's method involves using simple exponential smoothing (SES) on the non-zero elements of the time series and a separate application of (SES) to the times between non-zero elements of the time series.
intermittentATA(formula, ...)
Model specification (see "Specials" section).
Other arguments
A model specification.
There are two variant methods available which apply multiplicative correction factors to the forecasts that result from the original Croston's method. For the Syntetos-Boylan approximation (`type = "sba"`), this factor is \(1 - \alpha / 2\), and for the Shale-Boylan-Johnston method (`type = "sbj"`), this factor is \(1 - \alpha / (2 - \alpha)\), where \(\alpha\) is the smoothing parameter for the interval SES application.
Returns IntermittentATA[intermittent.type, D(p,q,phi)(E,T,S), I(p,q,phi)(E,T,S)] applied to time series data.
The Ata method based on the modified simple exponential smoothing as described in Yapar, G. (2016) <doi:10.15672/HJMS.201614320580> , Yapar G., Capar, S., Selamlar, H. T., Yavuz, I. (2017) <doi:10.15672/HJMS.2017.493> and Yapar G., Selamlar, H. T., Capar, S., Yavuz, I. (2019) <doi:10.15672/hujms.461032> is a new univariate time series forecasting method which provides innovative solutions to issues faced during the initialization and optimization stages of existing methods. Forecasting performance of the Ata method is superior to existing methods both in terms of easy implementation and accurate forecasting. It can be applied to non-seasonal or seasonal time series which can be decomposed into four components (remainder, level, trend and seasonal). This methodology performed well on the M3 and M4-competition data.
The _specials_ define the methods and parameters for the components (level, trend, accuracy, transform, holdout) of an ATA method for both of demand and interval time series.
There are a couple of limitations to note about ATA method:
- It supports only additive error term. - It does not support exogenous regressors. - It does not support missing values. You can complete missing values in the data with imputed values (e.g. with [tsibble::fill_gaps()], [tidyr::fill()], or by fitting a different model type and then calling [fabletools::interpolate()]) before fitting the model.
The `level` special is used to specify the form of the level term for the demand time series.
d_level(parP = NULL, level_fixed = TRUE, initial_level = "none")
`parP` | The value of the smoothing parameter for the level. If `p = 0`, the level will not change over time. Conversely, if `p = 1` the level will update similarly to a random walk process. If NULL or "opt", it is estimated. p has all integer values from 1 to length(data) . |
`level_fixed` | If TRUE, "pStarQ" --> First, fits ATA(p,0) where p = p* is optimized for q=0. Then, fits ATA(p*,q) where q is optimized for p = p*. |
`initial_level` | If NULL, "none" is default. If "none", ATA Method calculates the pth observation in data for level. If "mean", ATA Method calculates average of first p value in data for level. If "median", ATA Method calculates median of first p value in data for level. |
The `trend` special is used to specify the form of the trend term and associated parameters for the demand time series.
d_trend(type = "A", parQ = NULL, initial_trend = "none", opt_trend = "none",
parPHI = NULL, parPHI_range = c(0.8, 1.0), parPHI_increment = 0.01,
uroot_test = "adf", uroot_alpha = 0.05, uroot_type = "level")
`type` | The form of the trend term: either none ("N"), additive ("A"), multiplicative ("M") or damped variants ("Ad", "Md"). |
`parQ` | The value of the smoothing parameter for the slope. If `q = 0`, the slope will not change over time. Conversely, if `q = 1` the slope will have mean of past slopes. |
`parPHI` | The value of the dampening parameter for the slope. If `phi = 0`, the slope will be dampened immediately (no slope). Conversely, if `phi = 1` the slope will not be dampened. |
`parPHI_range` | If `phi=NULL`, `phi_range` provides bounds for the optimised value of `phi`. |
`parPHI_increment` | If `phi=NULL`, `parPHI_increment` provides increment step for searching `phi`. If NULL, `parPHI_increment` will be determined as the value that allows the `parPHI_range` to be divided into 20 equal parts. |
`initial_trend` | If NULL, "none" is default. If "none", ATA Method calculates the qth observation in data for trend. If "mean", ATA Method calculates average of first q value in X(T)-X(T-1) for trend. If "median", ATA Method calculates median of first q value in X(T)-X(T-1) for trend. |
`trend_opt` | Default is `none`. If `fixed` is set, "pBullet" --> Fits ATA(p,1) where p = p* is optimized for q = 1. If `search` is set "qBullet" --> Fits ATA(p,q) where p = p* is optimized for q = q* (q > 0). Then, fits ATA(p*,q) where q is optimized for p = p*. |
`uroot_test` | Type of unit root test before all type seasonality test. Possible values are "adf", "pp" and "kpss". |
`uroot_alpha` | Significant level of the unit root test, possible values range from 0.01 to 0.1. |
`uroot_type` | Specification of the deterministic component in the regression for unit root test. Possible values are "level" and "trend". |
`uroot_maxd` | Maximum number of non-seasonal differences allowed. |
The `accuracy` special is used to the optimization criterion for selecting the best ATA Method forecasting for the demand time series.
d_accuracy(criteria = "sMAPE", nmse = 3, ic = "AIC")
`criteria` | Accuracy measure for optimization of the best ATA Method forecasting. IF NULL, `sMAPE` is default. |
`nmse` | If `accuracy.type == "AMSE"`, `nmse` provides the number of steps for average multistep MSE `(2<=nmse<=30)`. |
`ic` | The information criterion used in selecting the model. |
The `transform` special is used to provide the applicability of different types of transformation techniques for the demand data to which the ATA method will be applied.
d_transform(method="none", order = "none", lambda = NULL, shift = 0,
bcMethod = "guerrero", bcLower = 0, bcUpper = 5)
`method` | Transformation method --> "Box_Cox", "Sqrt", "Reciprocal", "Log", "NegLog", "Modulus", "BickelDoksum", "Manly", "Dual", "YeoJohnson", "GPower", "GLog". If the transformation process needs shift parameter, it will be calculated required shift parameter automatically. |
`order` | Default is "none. If "before", Box-Cox transformation family will be applied and then seasonal decomposition techniques will be applied. If "after", seasonal decomposition techniques will be applied and then Box-Cox transformation family will be applied. |
`lambda` | Box-Cox power transformation family parameter. If NULL, data transformed before model is estimated. |
`shift` | Box-Cox power transformation family shifting parameter. If NULL, data transformed before model is estimated. |
`bcMethod` | Choose method to be used in calculating lambda. "guerrero" is default. Other method is "loglik". |
`bcLower` | Lower limit for possible lambda values. The lower value is limited by -5. Default value is 0. |
`bcUpper` | Upper limit for possible lambda values. The upper value is limited by 5. Default value is 5. |
The `holdout` special is used to improve the optimized parameter value obtained for the ATA Method forecasting for the demand time series.
d_holdout(holdout = FALSE, adjustment = TRUE, set_size = NULL, onestep = FALSE)
`holdout` | Default is FALSE. If TRUE, ATA Method uses the holdout forecasting for accuracy measure to select the best parameter set. In holdout forecasting, this parameter divides `data` into two parts: training set (in-sample) and validation set (holdout set). |
`adjustment` | Default is TRUE. If TRUE, `parP` will be adjusted by length of training, validation sets and main data set when the holdout forecasting is active. |
`set_size` | If `holdout` is TRUE, this parameter divides `data` into two parts: training set (in-sample) and validation set (holdout set). Also, this parameter will be same as `h` for defining holdout set. |
`onestep` | Default is FALSE. if TRUE, the dynamic forecast strategy uses a one-step model multiple times `h` (forecast horizon) where the holdout prediction for the prior time step is used as an input for making a prediction on the following time step. |
The `level` special is used to specify the form of the level term for the interval time series.
i_level(parP = NULL, level_fixed = TRUE, initial_level = "none")
`parP` | The value of the smoothing parameter for the level. If `p = 0`, the level will not change over time. Conversely, if `p = 1` the level will update similarly to a random walk process. If NULL or "opt", it is estimated. p has all integer values from 1 to length(data) . |
`level_fixed` | If TRUE, "pStarQ" --> First, fits ATA(p,0) where p = p* is optimized for q=0. Then, fits ATA(p*,q) where q is optimized for p = p*. |
`initial_level` | If NULL, "none" is default. If "none", ATA Method calculates the pth observation in data for level. If "mean", ATA Method calculates average of first p value in data for level. If "median", ATA Method calculates median of first p value in data for level. |
The `trend` special is used to specify the form of the trend term and associated parameters for the interval time series.
i_trend(type = "A", parQ = NULL, initial_trend = "none", opt_trend = "none",
parPHI = NULL, parPHI_range = c(0.8, 1.0), parPHI_increment = 0.01,
uroot_test = "adf", uroot_alpha = 0.05, uroot_type = "level")
`type` | The form of the trend term: either none ("N"), additive ("A"), multiplicative ("M") or damped variants ("Ad", "Md"). |
`parQ` | The value of the smoothing parameter for the slope. If `q = 0`, the slope will not change over time. Conversely, if `q = 1` the slope will have mean of past slopes. |
`parPHI` | The value of the dampening parameter for the slope. If `phi = 0`, the slope will be dampened immediately (no slope). Conversely, if `phi = 1` the slope will not be dampened. |
`parPHI_range` | If `phi=NULL`, `phi_range` provides bounds for the optimised value of `phi`. |
`parPHI_increment` | If `phi=NULL`, `parPHI_increment` provides increment step for searching `phi`. If NULL, `parPHI_increment` will be determined as the value that allows the `parPHI_range` to be divided into 20 equal parts. |
`initial_trend` | If NULL, "none" is default. If "none", ATA Method calculates the qth observation in data for trend. If "mean", ATA Method calculates average of first q value in X(T)-X(T-1) for trend. If "median", ATA Method calculates median of first q value in X(T)-X(T-1) for trend. |
`trend_opt` | Default is `none`. If `fixed` is set, "pBullet" --> Fits ATA(p,1) where p = p* is optimized for q = 1. If `search` is set "qBullet" --> Fits ATA(p,q) where p = p* is optimized for q = q* (q > 0). Then, fits ATA(p*,q) where q is optimized for p = p*. |
`uroot_test` | Type of unit root test before all type seasonality test. Possible values are "adf", "pp" and "kpss". |
`uroot_alpha` | Significant level of the unit root test, possible values range from 0.01 to 0.1. |
`uroot_type` | Specification of the deterministic component in the regression for unit root test. Possible values are "level" and "trend". |
`uroot_maxd` | Maximum number of non-seasonal differences allowed. |
The `accuracy` special is used to the optimization criterion for selecting the best ATA Method forecasting for the interval time series.
i_accuracy(criteria = "sMAPE", nmse = 3, ic = "AIC")
`criteria` | Accuracy measure for optimization of the best ATA Method forecasting. IF NULL, `sMAPE` is default. |
`nmse` | If `accuracy.type == "AMSE"`, `nmse` provides the number of steps for average multistep MSE `(2<=nmse<=30)`. |
`ic` | The information criterion used in selecting the model. |
The `transform` special is used to provide the applicability of different types of transformation techniques for the interval data to which the ATA method will be applied.
i_transform(method="none", order = "none", lambda = NULL, shift = 0,
bcMethod = "guerrero", bcLower = 0, bcUpper = 5)
`method` | Transformation method --> "Box_Cox", "Sqrt", "Reciprocal", "Log", "NegLog", "Modulus", "BickelDoksum", "Manly", "Dual", "YeoJohnson", "GPower", "GLog". If the transformation process needs shift parameter, it will be calculated required shift parameter automatically. |
`order` | Default is "none. If "before", Box-Cox transformation family will be applied and then seasonal decomposition techniques will be applied. If "after", seasonal decomposition techniques will be applied and then Box-Cox transformation family will be applied. |
`lambda` | Box-Cox power transformation family parameter. If NULL, data transformed before model is estimated. |
`shift` | Box-Cox power transformation family shifting parameter. If NULL, data transformed before model is estimated. |
`bcMethod` | Choose method to be used in calculating lambda. "guerrero" is default. Other method is "loglik". |
`bcLower` | Lower limit for possible lambda values. The lower value is limited by -5. Default value is 0. |
`bcUpper` | Upper limit for possible lambda values. The upper value is limited by 5. Default value is 5. |
The `holdout` special is used to improve the optimized parameter value obtained for the ATA Method forecasting for the interval time series.
i_holdout(holdout = FALSE, adjustment = TRUE, set_size = NULL, onestep = FALSE)
`holdout` | Default is FALSE. If TRUE, ATA Method uses the holdout forecasting for accuracy measure to select the best parameter set. In holdout forecasting, this parameter divides `data` into two parts: training set (in-sample) and validation set (holdout set). |
`adjustment` | Default is TRUE. If TRUE, `parP` will be adjusted by length of training, validation sets and main data set when the holdout forecasting is active. |
`set_size` | If `holdout` is TRUE, this parameter divides `data` into two parts: training set (in-sample) and validation set (holdout set). Also, this parameter will be same as `h` for defining holdout set. |
`onestep` | Default is FALSE. if TRUE, the dynamic forecast strategy uses a one-step model multiple times `h` (forecast horizon) where the holdout prediction for the prior time step is used as an input for making a prediction on the following time step. |
The `intermittent` special is used to improve the optimized parameter value obtained for the ATA Method forecasting for the interval time series.
intermittent(type = "croston")
`type` | Default is "croston". For the Syntetos-Boylan approximation (`type = "sba"`), this factor is \(1 - \alpha / 2\), and for the Shale-Boylan-Johnston method (`type = "sbj"`), this factor is \(1 - \alpha / (2 - \alpha)\), where \(\alpha\) is the smoothing parameter for the interval ATA Method application. |
library(intermittentATA)
as_tsibble(fmcgData) %>% model(crostonata = intermittentATA(value ~ d_trend(type = "M", parQ = 1) + i_trend("A") + intermittent("croston")))
#> # A mable: 1 x 1
#> crostonata
#> <model>
#> 1 <IntermittentATA[croston, D(2,1,0) (A,M,N), I(3,3,0.2) (A,Ad,N)]>