crossValidationFunctions: Generalised Rolling Origin Evaluation

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

Description

This function implements the Generalised Rolling Origin Evaluation of Fioruci et al (2015). Its particular cases include the cross validation methods: Rolling Origin Evaluation and Fixed Origin Evaluation of Tashman(2000).

Usage

1
2
3
4
5
6
	groe(y, forecFunction, g="sAPE", n1=length(y)-10, m=5, 
	        H=length(y)-n1, p=1+floor((length(y)-n1)/m), ...)
	
	rolOrig(y, forecFunction, g="sAPE", n1=length(y)-10, ...)
	
	fixOrig(y, forecFunction, g="sAPE", n1=length(y)-10, ...)

Arguments

y

Object of time series class or a vector

forecFunction

A forecasting method as one object of the forecast class of forecast package.

g

The prediction error type of errorMetric function. The possible values are "sAPE", "APE", "AE" and "SE".

n1

The index of the first origin element.

m

The number of movements of the origin in each update.

H

The number of predictions forward of each origin.

p

The number of origin updates. Default is the maximum.

...

Additional arguments for forecFunction.

Details

If m=1 is computed the Rolling Origin Evaluation. If m>=length(y)-n1 is computed the Fixed Origin Evaluation.

Value

The sum of the prediction errors.

Note

The otm.arxiv function use this function for estimate the theta parameter when the theta argument is NULL. Your computer may go into an infinite looping if you use forecFunction = otm.arxiv without specific a numeric value for the theta argument.

Author(s)

Jose Augusto Fiorucci and Francisco Louzada

References

Fioruci J.A., Pellegrini T.R., Louzada F., Petropoulos F. (2015). The Optimised Theta Method. Free available at http://arxiv.org/abs/1503.03529.

Tashman, L.J. (2000). Out-of-sample tests of forecasting accuracy: an analysis and review. International Journal of Forecasting 16 (4), 437–450.

See Also

forecTheta-package, dotm, otm.arxiv

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
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))

## Rolling Origin Evaluation
rolOrig( y=y, forecFunction = dotm, n1=40)
rolOrig( y=y, forecFunction = expSmoot, n1=40)
rolOrig( y=y, forecFunction = stheta, n1=40)
rolOrig( y=y, forecFunction = otm.arxiv, n1=40, theta=3)

## Fixed Origin Evaluation
fixOrig( y=y, forecFunction = dotm, n1=40)
fixOrig( y=y, forecFunction = expSmoot, n1=40)
fixOrig( y=y, forecFunction = stheta, n1=40)
fixOrig( y=y, forecFunction = otm.arxiv, n1=40, theta=3)

## Generalised Rolling Origin Evaluation with two origin updates.
## Where the first is the 40th element and second is the 45th element
groe( y=y, forecFunction = dotm, m=5, n1=40)
groe( y=y, forecFunction = expSmoot, m=5, n1=40)
groe( y=y, forecFunction = stheta, m=5, n1=40)
groe( y=y, forecFunction = otm.arxiv, m=5, n1=40, theta=3)

Example output

Loading required package: parallel
Loading required package: forecast
Loading required package: tseries
[1] 346.1663
[1] 496.1263
[1] 350.6841
[1] 334.2328
[1] 55.43405
[1] 105.2906
[1] 60.33442
[1] 53.27837
[1] 83.3575
[1] 144.5882
[1] 87.60903
[1] 80.9585

forecTheta documentation built on May 2, 2019, 6:35 a.m.