# otm.arXiv: Optimised Theta Method In forecTheta: Forecasting Time Series by Theta Models

 otm.arxiv R Documentation

## Optimised Theta Method

### Description

Functions for forecast univariate time series using the Optimised Theta Method presented in the arxiv paper (Fioruci et al, 2015). If the theta parameter is not specified so the Generalised Rolling Origin Evaluation is used for select the theta value over the thetaList argument.

### Usage

```	otm.arxiv( y, h=5, s=NULL, theta=NULL, tLineExtrap=expSmoot, g="sAPE",
approach="c", n1=NULL, m=NULL, H=NULL, p=NULL,
thetaList=seq(from=1,to=5,by=0.5), mc.cores=1, ...)
```

### Arguments

 `y` Object of time series class `h` Number of required forecasting periods `s` If `TRUE`, the multiplicative seasonal decomposition is used. If `NULL`, quarterly and monthly time series are tested for statistically seasonal behaviour, with 95% of significance. Default is NULL. `theta` The value of theta parameter. If `theta = NULL` the theta parameter is estimated using the Generalised Rolling Origin Evaluation. `tLineExtrap` A forecasting function for extrapolation the second theta-line. Default is `expSmoot`. `g` The error type that will be used by `groe` function for select the `theta` value in the estimation process. The possibility values for `g` is `"sAPE", "APE", "AE"` and `"SE"`. If `theta` is not `NULL` the `g` argument is not used. Default is "sAPE". `approach` The approach set-up for `groe` parameters (`n1, m, H, p`). One letter between `'a'` to `'h'` according to Fioruci et al (2015). `n1` The first origin for Generalised Rolling Origin Evaluation. This argument is not used if `theta!=NULL` or `approach!=NULL`. `m` The number of movements of the origin in each step. This argument is not used if `theta!=NULL` or `approach!=NULL`. `H` The number of predictions in each step. This argument is not used if `theta!=NULL` or `approach!=NULL`. `p` The number of origin updates. This argument is not used if `theta!=NULL` or `approach!=NULL`. `thetaList` A vector with the possible values for `theta`. This argument is not used if `theta` argument is not `NULL`. `mc.cores` Number of cores that will be used for estimate the theta parameter. It is not accepted `mc.cores>1` on Windows SO. `...` Additional arguments for `tLineExtrap`.

### Details

These functions are fully automatic, you just need to pass your time series. Particular cases are obtained by: If `theta = 1` the `tLineExtrapModel` method is computed; If `theta = 2` so the Standard Theta Method of Assimakopoulos and Nikolopoulos (2000) is computed.

By default (`s=NULL`), the 90% significance seasonal Z-test, used by Assimakopoulos and Nikolopoulos (2000), is applied for quarterly and monthly time series.

### Value

An list containing the elements:

 `\$y ` The original time series. `\$mean ` A time series element with the forecasting points. `\$fitted ` A time series element with the fitted points. `\$residuals ` A time series element with the residual points. `\$theta ` The estimated theta value. `\$tLineExtrap_par ` The estimated parameters of `tLineExtrap` method. `\$weights ` The estimated weights values.

### Note

The `thetaM` function is just a particular case of `otm` with `theta=2`.

### References

Fioruci J.A., Pellegrini T.R., Louzada F., Petropoulos F. (2015). The Optimised Theta Method. arXiv preprint, arXiv:1503.03529.

Assimakopoulos, V. and Nikolopoulos k. (2000). The theta model: a decomposition approach to forecasting. International Journal of Forecasting 16, 4, 521-530.

`forecTheta-package`, `dotm`, `groe`

### Examples

```
y1 = 2+ 0.15*(1:20) + rnorm(20,2)
y2 = y1[20]+ 0.3*(1:30) + rnorm(30,2)
y =  as.ts(c(y1,y2))

otm.arxiv(y, h=10)

### running the M3-competition data base by OTM approach (a) ###
#require(Mcomp)
#data(M3)
#
#forec = matrix(NA, nrow=3003, ncol=18)
#obs = matrix(NA, nrow=3003, ncol=18) #matrix of the out-sample values
#
#for(i in 1:3003){
#	if(i %% 100 == 0){print(i)}
#	x=M3[[i]]\$x
#	h=M3[[i]]\$h
#	out = otm.arxiv(x,h,approach='a',tLineExtrap=ses)
#	forec[i,1:h] = out\$mean
#	obs[i,1:h] = M3[[i]]\$xx
#}
#
#sAPE = errorMetric(obs, forec, type="sAPE", statistic="N") ## sAPE matrix
#
##### sMAPE results ##
### Yearly
#mean( sAPE[1:645, 1:6] )
### QUARTERLY
#mean( sAPE[646:1401, 1:8] )
### MONTHLY
#mean( sAPE[1402:2829, 1:18] )
### Other
#mean( sAPE[2830:3003, 1:8] )
### ALL
#mean( sAPE, na.rm=TRUE )

```

forecTheta documentation built on Nov. 12, 2022, 1:09 a.m.