ATA: Forecasting Time Series by ATA Method with Box-Cox Power...

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/ATA.R

Description

ATA is a generic function for ATA Method forecasting from time series or time series models.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
ATA(
  X,
  Y = NULL,
  parP = NULL,
  parQ = NULL,
  parPHI = NULL,
  model.type = NULL,
  seasonal.test = NULL,
  seasonal.model = NULL,
  seasonal.period = NULL,
  seasonal.type = NULL,
  seasonal.test.attr = NULL,
  find.period = NULL,
  accuracy.type = NULL,
  level.fixed = FALSE,
  trend.fixed = FALSE,
  trend.search = FALSE,
  h = NULL,
  partition.h = NULL,
  holdout = FALSE,
  holdout.adjustedP = TRUE,
  holdin = FALSE,
  transform.order = "before",
  transform.method = NULL,
  transform.attr = NULL,
  lambda = NULL,
  shift = NULL,
  initial.level = NULL,
  initial.trend = NULL,
  ci.level = 95,
  start.phi = NULL,
  end.phi = NULL,
  size.phi = NULL,
  negative.forecast = TRUE,
  print.out = TRUE,
  plot.out = TRUE
)

Arguments

X

A numeric vector or time series of class ts or msts for in-sample.

Y

A numeric vector or time series of class ts or msts for out-sample. If you do not have out-sample data, you can split in-sample data into training and test dataset with partition.h argument.

parP

Value of Level parameter p. If NULL or "opt", it is estimated. p has all integer values from 1 to length(X).

parQ

Value of Trend parameter q. If NULL or "opt", it is estimated. q has all integer values from 0 to p.

parPHI

Value of Damping Trend parameter phi. If NULL or "opt", it is estimated. phi has all values from 0 to 1.

model.type

An one-character string identifying method using the framework terminology. The letter "A" for additive model, the letter "M" for multiplicative model. If NULL, both letters will be tried and the best model (according to the accuracy measure accuracy.type) returned.

seasonal.test

Testing for stationary and seasonality. If TRUE, the method firstly uses test="adf", Augmented Dickey-Fuller, unit-root test then the test returns the least number of differences required to pass the test at level alpha. After the unit-root test, seasonal test applies on the stationary X.

seasonal.model

A string identifying method for seasonal decomposition. If NULL, "decomp" method is default. c("none", "decomp", "stl", "stlplus", "tbats", "stR") phrases of methods denote

  • none : seasonal decomposition is not required.

  • decomp : classical seasonal decomposition. If decomp, the stats package will be used.

  • stl : seasonal-trend decomposition procedure based on loess developed by Cleveland et al. (1990). If stl, the stats and forecast packages will be used. Multiple seasonal periods are allowed.

  • stlplus : seasonal-trend decomposition procedure based on loess developed by Cleveland et al. (1990). If stlplus, the stlplus package will be used.

  • tbats : exponential smoothing state space model with box-cox transformation, ARMA errors, trend and seasonal components. as described in De Livera, Hyndman & Snyder (2011). Parallel processing is used by default to speed up the computations. If tbats, the forecast package will be used. Multiple seasonal periods are allowed.

  • stR : seasonal-trend decomposition procedure based on regression developed by Dokumentov and Hyndman (2015). If stR, the stR package will be used. Multiple seasonal periods are allowed.

  • x13 : seasonal-trend decomposition procedure based on X13ARIMA/SEATS. If x13, the seasonal package will be used.

  • x11 : seasonal-trend decomposition procedure based on X11. If x11, the seasonal package will be used.

seasonal.period

Value(s) of seasonal periodicity. If NULL, frequency of X is default If seasonal.period is not integer, X must be msts time series object. c(s1,s2,s3,...) for multiple period. If X has multiple periodicity, "tbats" or "stR" seasonal model have to be selected.

seasonal.type

An one-character string identifying method for the seasonal component framework. If NULL, "M" is default. The letter "A" for additive model, the letter "M" for multiplicative model. If other seasonal decomposition method except decomp with "M", Box-Cox transformation with lambda=0 is selected.

seasonal.test.attr

Attributes set for unit root, seasonality tests, X13ARIMA/SEATS and X11. If NULL, corrgram.tcrit=1.28, uroot.test="adf", suroot.test="correlogram", suroot.uroot=TRUE, uroot.type="trend", uroot.alpha=0.05, suroot.alpha=0.05, uroot.maxd=2, suroot.maxD=1, suroot.m=frequency(X), uroot.pkg="ucra", multi.period="min", x13.estimate.maxiter=1500, x13.estimate.tol=1.0e-5, x11.estimate.maxiter=1500, x11.estimate.tol=1.0e-5. If you want to change, please use ATA.SeasAttr function and its output. For example, you can use seasonal.test.attr = ATA.SeasAttr(corrgram.tcrit=1.65) equation in ATA function.

find.period

Find seasonal period(s) automatically. If NULL, 0 is default. When find.period,

  • 0 : none

  • 1 : single period with find.freq

  • 2 : single period with forecast::findfrequency

  • 3 : multiple period with find.freq & stR

  • 4 : multiple period with find.freq & tbats

  • 5 : multiple period with find.freq & stl

accuracy.type

Accuracy measure for selection of the best model. IF NULL, sMAPE is default.

  • MAE : mean absolute error.

  • MSE : mean square error.

  • RMSE : root mean squared error.

  • MPE : mean percentage error.

  • MAPE : mean absolute percentage error.

  • sMAPE : symmetric mean absolute percentage error.

  • MASE : mean absolute scaled error.

  • OWA : overall weighted average of MASE and sMAPE.

  • MdAE : median absolute error.

  • MdSE : median square error.

  • RMdSE : root median squared error.

  • MdPE : median percentage error.

  • MdAPE : median absolute percentage error.

  • sMdAPE : symmetric median absolute percentage error.

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*.

trend.fixed

If TRUE, "pBullet" –> Fits ATA(p,1) where p = p* is optimized for q = 1.

trend.search

If TRUE, "qBullet" –> Fits ATA(p,q) where p = p* is optimized for q = q* (q > 0).

h

The number of steps to forecast ahead. When the parameter is NULL; if the frequency of X is 4 the parameter is set to 8; if the frequency of X is 12 the parameter is set to 18; the parameter is set to 6 for other cases.

partition.h

If Y is NULL, this parameter divides X into two parts: training set (in-sample) and test set (out-sample). partition.h is number of periods for forecasting and size of test set. If the value is between 0 and 1, percentage of length is active. If holdout is TRUE, this parameter will be same as h for defining holdout set.

holdout

Default is FALSE. If TRUE, ATA Method uses the holdout forecasting for accuracy measure to select the best model. In holdout forecasting, the last few data points are removed from the data series. The remaining historical data series is called in-sample data (training set), and the holdout data is called out-of-sample data (holdout set). If TRUE, partition.h will used for holdout data.

holdout.adjustedP

Default is TRUE. If TRUE, parP will be adjusted by length of training - validation sets and in-sample set when the holdout forecasting is active.

holdin

Default is FALSE. If TRUE, ATA Method uses the hold-in forecasting for accuracy measure to select the best model. In hold-in forecasting, the last h-length data points are used for accuracy measure.

transform.order

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.

transform.method

Transformation method –> BoxCox, BoxCox Shift, Modulus, Bickel-Doksum, Dual, Yeo-Johnson, GPower, GLog, Log, Log Shift. When Box-Cox power transformation family is specified, model.type and seasonal.type are set to "A".

transform.attr

Attributes set for Box-Cox transformation. If NULL, bcMethod = "loglik", bcLower = 0, bcUpper = 1, bcBiasAdj = FALSE. If you want to change, please use ATA.BoxCoxAttr function and its output.

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. When lambda is specified, model.type and seasonal.type is set to "A".

initial.level

If NULL, FALSE is default. If FALSE, ATA Method calculates the pth observation in X for level. If TRUE, ATA Method calculates average of first p value in Xfor level.

initial.trend

If NULL, FALSE is default. If FALSE, ATA Method calculates the qth observation in X(T)-X(T-1) for trend. If TRUE, ATA Method calculates average of first q value in X(T)-X(T-1) for trend.

ci.level

Confidence Interval levels for forecasting.

start.phi

Lower boundary for searching parPHI.If NULL, 0 is default.

end.phi

Upper boundary for searching parPHI. If NULL, 1 is is default.

size.phi

Increment step for searching parPHI. If NULL, 0.05 is default.

negative.forecast

Negative values are allowed for forecasting. Default value is TRUE. If FALSE, all negative values for forecasting are set to 0.

print.out

Default is TRUE. If FALSE, summary of ATA Method is not shown.

plot.out

Default is TRUE. If FALSE, graphics of ATA Method are not shown.

Value

Returns an object of class ATA. The generic accessor functions ATA.Forecast and ATA.Accuracy extract useful features of the value returned by ATA and associated functions. ATA object is a list containing at least the following elements

Author(s)

Ali Sabri Taylan and Hanife Taylan Selamlar

References

Yapar, G., (2016) "Modified simple exponential smoothing" Hacettepe University Journal of Mathematics and Statistics Early Access. Doi:10.15672/HJMS.201614320580

Yapar, G., Capar, S., Selamlar, H. T., Yavuz, I., (2016) "Modified holt's linear trend method" Hacettepe University Journal of Mathematics and Statistics Early Access. Doi: 10.15672/HJMS.2017.493

See Also

forecast, stlplus, stR, stl, decompose, tbats, seasadj, seasonal.

Examples

1
2
fit <- ATA(M3[[1899]]$x, M3[[1899]]$xx)
plot(ATA.Forecast(fit,h=36))

alsabtay/ATAforecasting documentation built on Dec. 1, 2019, 5:26 a.m.