Package ‘TSprediction’
September 23, 2010
Title Time-series forecasting package
Description TSprediction is a simple package that implements prediction methods to forecast the time-series.
Version 1.56 Date 2010-08-20
Author Tomasz Bartlomowicz<[email protected]> Maintainer Tomasz Bartlomowicz<[email protected]> License GPL (>= 2)
URL www.r-project.org,http://keii.ue.wroc.pl/TSprediction Repository CRAN
R
topics documented:
addRatio . . . 2 addWinters . . . 2 allNaive . . . 3 allTrend . . . 4 chart . . . 5 expSmoothing . . . 6 Holt . . . 6 MAE . . . 7 MAPE . . . 8 ME . . . 9 movAverage . . . 9 MPE . . . 10 MSE . . . 11 mulRatio . . . 12 mulWinters . . . 13 RMSE . . . 14 Index 15 12 addWinters
addRatio Function addRatio calculates forecasts using additive ratio method
Description
Function addRatio calculates forecasts using additive ratio method. Function returns vector of fore-casts. Usage addRatio(x, r=4, horizon=4) Arguments x vector of time-series r length of sezon
horizon number of forecasts Author(s)
Tomasz Bartlomowicz<[email protected]>Department of Economet-rics and Computer Science, University of Economics, Wroclaw, Poland http://keii.ue. wroc.pl/TSprediction
References
Cieslak M. (red.), Prognozowanie gospodarcze. Metody i zastosowania, PWN, Warszawa 1997 See Also mulRatio Examples library(TSprediction) data(TSdata) addratio=addRatio(w, 4, 8) print(addratio)
addWinters Function addWinters calculates forecasts using additive Winters’ model
Description
Function addWinters calculates forecasts using additive Winters’ model. Function returns vector of forecasts.
Usage
allNaive 3 Arguments
x vector of time-series
r length of sezon (number of forecasts) alfa alfa parameter
beta beta parameter
gamma gamma parameter
typeF kind of F argument. typeF should be one of two values: ’first’ or ’mean’ typeS kind of S argument. typeS should be one of two values: ’difference’ or ’zero’ typeC kind of C argument. typeC should be one of two values: ’ratio’ or ’one’
Author(s)
Tomasz Bartlomowicz<[email protected]>Department of Economet-rics and Computer Science, University of Economics, Wroclaw, Poland http://keii.ue. wroc.pl/TSprediction
References
Cieslak M. (red.), Prognozowanie gospodarcze. Metody i zastosowania, PWN, Warszawa 1997 See Also Holt Examples library(TSprediction) data(TSdata) addwinters=addWinters(w, 4, 0.5, 0.95, 0.2) print(addwinters)
allNaive Function allNaive calculates forecasts using naive methods
Description
Function allNaive calculates forecasts using naive methods. Functions returns vector of forecasts. Usage
allNaive(x, model=1, c=0) Arguments
x vector of time-series model kind of naive method
4 allTrend
Author(s)
Tomasz Bartlomowicz<[email protected]>Department of Economet-rics and Computer Science, University of Economics, Wroclaw, Poland http://keii.ue. wroc.pl/TSprediction
References
Cieslak M. (red.), Prognozowanie gospodarcze. Metody i zastosowania, PWN, Warszawa 1997 See Also Holt Examples library(TSprediction) data(TSdata) naive1=allNaive(x) print(naive1)
allTrend Function allTrend calculates forecasts using trend models
Description
Function allTrend calculates forecasts using trend models. Functions returns vector of forecasts. Usage
allTrend(x, model=1, horizon=3)
Arguments
x vector of time-series
horizon forecast’s time lead (number of forecasts) model kind of analytical model
Author(s)
Tomasz Bartlomowicz<[email protected]>Department of Economet-rics and Computer Science, University of Economics, Wroclaw, Poland http://keii.ue. wroc.pl/TSprediction
References
Cieslak M. (red.), Prognozowanie gospodarcze. Metody i zastosowania, PWN, Warszawa 1997 See Also
chart 5 Examples library(TSprediction) data(TSdata) trend1=allTrend(x) print(trend1)
chart Function chart draws data and forecasts on the same plot
Description
Function chart draws data and forecasts on the same plot Usage
chart(xx, yy, typeC="o", lwd1=2, lwd2=2, col1="dark red", col2="dark blue") Arguments
xx vector of data
yy vector of forecasts typeC kind of chart lwd1 forecast’s time lead
lwd2 kind of F argument. typeF should be one of two values: ’first’ or ’mean’ col1 kind of S argument. typeS should be one of two values: ’difference’ or ’zero’ col2 kind of S argument. typeS should be one of two values: ’difference’ or ’zero’ Author(s)
Tomasz Bartlomowicz<[email protected]>Department of Economet-rics and Computer Science, University of Economics, Wroclaw, Poland http://keii.ue. wroc.pl/TSprediction
References
Cieslak M. (red.), Prognozowanie gospodarcze. Metody i zastosowania, PWN, Warszawa 1997 See Also allNaive Examples library(TSprediction) data(TSdata) y=allNaive(x, 1) chart(x, y)
6 Holt
expSmoothing Function expSmoothing calculates forecasts using exponential smoothing model
Description
Function expSmoothing calculates forecasts using exponential smoothing model. Function returns vector of forecasts.
Usage
expSmoothing(x, alfa=0) Arguments
x vector of time-series alfa alfa parameter Author(s)
Tomasz Bartlomowicz<[email protected]>Department of Economet-rics and Computer Science, University of Economics, Wroclaw, Poland http://keii.ue. wroc.pl/TSprediction
References
Cieslak M. (red.), Prognozowanie gospodarcze. Metody i zastosowania, PWN, Warszawa 1997 See Also Holt Examples library(TSprediction) data(TSdata) expsmoothing=expSmoothing(x, 0.75) print(expsmoothing)
Holt Function Holt calculates forecasts using Holt’s model
Description
Function Holt calculates forecasts using Holt’s model. Function returns vector of forecasts. Usage
MAE 7 Arguments
x vector of time-series alfa alfa parameter beta beta parameter horizon forecast’s time lead
typeF kind of F argument. typeF should be one of two values: ’first’ or ’mean’ typeS kind of S argument. typeS should be one of two values: ’difference’ or ’zero’ Author(s)
Tomasz Bartlomowicz<[email protected]>Department of Economet-rics and Computer Science, University of Economics, Wroclaw, Poland http://keii.ue. wroc.pl/TSprediction
References
Cieslak M. (red.), Prognozowanie gospodarcze. Metody i zastosowania, PWN, Warszawa 1997 See Also allNaive Examples library(TSprediction) data(TSdata) holt=Holt(x, 0.3, 0.7, 4) print(holt)
MAE Function MAE calculates mean absolute error (MAE)
Description
Function MAE calculates mean absolute error (MAE). Function returns vector of errors and value of MAE.
Usage
MAE(x, y) Arguments
x vector of empirical data y vector of forecasts Author(s)
Tomasz Bartlomowicz<[email protected]>Department of Economet-rics and Computer Science, University of Economics, Wroclaw, Poland http://keii.ue. wroc.pl/TSprediction
8 MAPE
References
Cieslak M. (red.), Prognozowanie gospodarcze. Metody i zastosowania, PWN, Warszawa 1997 See Also ME Examples library(TSprediction) data(TSdata) mae=MAE(x, y) print(mae)
MAPE Function MAPE calculates mean absolute percentage error (MAPE)
Description
Function MAPE calculates mean absolute percentage error (MAPE). Function returns vector of errors and value of MAPE.
Usage
MAPE(x, y) Arguments
x vector of empirical data y vector of forecasts Author(s)
Tomasz Bartlomowicz<[email protected]>Department of Economet-rics and Computer Science, University of Economics, Wroclaw, Poland http://keii.ue. wroc.pl/TSprediction
References
Cieslak M. (red.), Prognozowanie gospodarcze. Metody i zastosowania, PWN, Warszawa 1997 See Also MPE Examples library(TSprediction) data(TSdata) mape=MAPE(x, y) print(mape)
ME 9
ME Function ME calculates mean error (ME)
Description
Function ME calculates mean error (ME). Function returns vector of errors and value of ME. Usage
ME(x, y)
Arguments
x vector of empirical data y vector of forecasts
Author(s)
Tomasz Bartlomowicz<[email protected]>Department of Economet-rics and Computer Science, University of Economics, Wroclaw, Poland http://keii.ue. wroc.pl/TSprediction
References
Cieslak M. (red.), Prognozowanie gospodarcze. Metody i zastosowania, PWN, Warszawa 1997 See Also MAE Examples library(TSprediction) data(TSdata) me=ME(x, y) print(me)
movAverage Function movAverage calculates forecasts using moving average method
Description
Function movAverage calculates forecasts using moving average method. Function returns vector of forecasts.
Usage
10 MPE
Arguments
x vector of time-series k parameter of smoothing Author(s)
Tomasz Bartlomowicz<[email protected]>Department of Economet-rics and Computer Science, University of Economics, Wroclaw, Poland http://keii.ue. wroc.pl/TSprediction
References
Cieslak M. (red.), Prognozowanie gospodarcze. Metody i zastosowania, PWN, Warszawa 1997 See Also Holt Examples library(TSprediction) data(TSdata) movaverage=movAverage(x, 3) print(movaverage)
MPE Function MPE calculates mean percentage error (MPE)
Description
Function MPE calculates mean percentage error (MPE). Function returns vector of errors and value of MPE.
Usage
MPE(x, y) Arguments
x vector of empirical data y vector of forecasts Author(s)
Tomasz Bartlomowicz<[email protected]>Department of Economet-rics and Computer Science, University of Economics, Wroclaw, Poland http://keii.ue. wroc.pl/TSprediction
References
MSE 11 See Also MAPE Examples library(TSprediction) data(TSdata) mpe=MPE(x, y) print(mpe)
MSE Function MSE calculates mean squared error (MSE)
Description
Function MSE calculates mean squared error (MSE). Function returns vector of errors and value of MSE.
Usage
MSE(x, y)
Arguments
x vector of empirical data y vector of forecasts
Author(s)
Tomasz Bartlomowicz<[email protected]>Department of Economet-rics and Computer Science, University of Economics, Wroclaw, Poland http://keii.ue. wroc.pl/TSprediction
References
Cieslak M. (red.), Prognozowanie gospodarcze. Metody i zastosowania, PWN, Warszawa 1997
See Also MPE Examples library(TSprediction) data(TSdata) mse=MSE(x, y) print(mse)
12 mulRatio
mulRatio Function mulRatio calculates forecasts using multiplicative ratio method
Description
Function mulRatio calculates forecasts using multiplicative ratio method. Function returns vector of forecasts. Usage mulRatio(x, r=4, horizon=4) Arguments x vector of time-series r length of sezon
horizon number of forecasts
Author(s)
Tomasz Bartlomowicz<[email protected]>Department of Economet-rics and Computer Science, University of Economics, Wroclaw, Poland http://keii.ue. wroc.pl/TSprediction
References
Cieslak M. (red.), Prognozowanie gospodarcze. Metody i zastosowania, PWN, Warszawa 1997
See Also addRatio Examples library(TSprediction) data(TSdata) mulratio=mulRatio(w, 4, 8) print(mulratio)
mulWinters 13
mulWinters Function mulWinters calculates forecasts using multiplicative Win-ters’ model
Description
Function mulWinters calculates forecasts using multiplicative Winters’ model. Function returns vector of forecasts.
Usage
mulWinters(x, r=4, alfa=0, beta=0, gamma=0, typeF="first", typeS="difference", typeC="ratio")
Arguments
x vector of time-series
r length of sezon (number of forecasts) alfa alfa parameter
beta beta parameter
gamma gamma parameter
typeF kind of F argument. typeF should be one of two values: ’first’ or ’mean’ typeS kind of S argument. typeS should be one of two values: ’difference’ or ’zero’ typeC kind of C argument. typeC should be one of two values: ’ratio’ or ’one’
Author(s)
Tomasz Bartlomowicz<[email protected]>Department of Economet-rics and Computer Science, University of Economics, Wroclaw, Poland http://keii.ue. wroc.pl/TSprediction
References
Cieslak M. (red.), Prognozowanie gospodarcze. Metody i zastosowania, PWN, Warszawa 1997
See Also Holt Examples library(TSprediction) data(TSdata) mulwinters=mulWinters(w, 4, 0.5, 0.95, 0.2) print(mulwinters)
14 RMSE
RMSE Function RMSE calculates root mean squared error (RMSE)
Description
Function RMSE calculates root mean squared error (RMSE). Function returns vector of errors and value of RMSE.
Usage
RMSE(x, y) Arguments
x vector of empirical data y vector of forecasts Author(s)
Tomasz Bartlomowicz<[email protected]>Department of Economet-rics and Computer Science, University of Economics, Wroclaw, Poland http://keii.ue. wroc.pl/TSprediction
References
Cieslak M. (red.), Prognozowanie gospodarcze. Metody i zastosowania, PWN, Warszawa 1997 See Also MSE Examples library(TSprediction) data(TSdata) rmse=RMSE(x, y) print(rmse)