Example: bachelor of science

Package ‘forecast’ - The Comprehensive R Archive …

Package forecast March 31, Functions for time series and Linear ModelsDescriptionMethods and tools for displaying and analysingunivariate time series forecasts including exponential smoothingvia state space models and automatic ARIMA (>= ),Importscolorspace, fracdiff, ggplot2 (>= ), graphics, lmtest,magrittr, nnet, parallel, Rcpp (>= ), stats, timeDate,tseries, urca, zooSuggestsuroot, knitr, rmarkdown, rticles, testthat, methodsLinkingToRcpp (>= ), RcppArmadillo (>= ) , Hyndman [aut, cre, cph] (< >),George Athanasopoulos [aut],Christoph Bergmeir [aut] (< >),Gabriel Caceres [aut],Leanne Chhay [aut],Mitchell O'Hara-Wild [aut] (< >),Fotios Petropoulos [aut] (< >),Slava Razbash [aut],Earo Wang [aut],12 Rtopics documented:Farah Yasmeen [aut] (< >),R Core Team [ctb, cph],Ross Ihaka [ctb, cph],Daniel Reid [ctb],David Shaub [ctb],Yuan Tang [ctb] (< >),Zhenyu Zhou [ctb]MaintainerRob 14:10:07 UTCR topics documented:forecast- Package ..4accuracy ..4 Acf.

Package ‘forecast’ June 21, 2018 Version 8.4 Title Forecasting Functions for Time Series and Linear Models Description Methods and tools for displaying and analysing

Tags:

  Series, Time, Time series, Packages, Forecasting

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of Package ‘forecast’ - The Comprehensive R Archive …

1 Package forecast March 31, Functions for time series and Linear ModelsDescriptionMethods and tools for displaying and analysingunivariate time series forecasts including exponential smoothingvia state space models and automatic ARIMA (>= ),Importscolorspace, fracdiff, ggplot2 (>= ), graphics, lmtest,magrittr, nnet, parallel, Rcpp (>= ), stats, timeDate,tseries, urca, zooSuggestsuroot, knitr, rmarkdown, rticles, testthat, methodsLinkingToRcpp (>= ), RcppArmadillo (>= ) , Hyndman [aut, cre, cph] (< >),George Athanasopoulos [aut],Christoph Bergmeir [aut] (< >),Gabriel Caceres [aut],Leanne Chhay [aut],Mitchell O'Hara-Wild [aut] (< >),Fotios Petropoulos [aut] (< >),Slava Razbash [aut],Earo Wang [aut],12 Rtopics documented:Farah Yasmeen [aut] (< >),R Core Team [ctb, cph],Ross Ihaka [ctb, cph],Daniel Reid [ctb],David Shaub [ctb],Yuan Tang [ctb] (< >),Zhenyu Zhou [ctb]MaintainerRob 14:10:07 UTCR topics documented:forecast- Package ..4accuracy ..4 Acf.

2 6arfima ..9 Arima .. 13arimaorder .. 14autolayer .. 24baggedModel .. 25bats .. 27bizdays .. 30 BoxCox .. 32checkresiduals .. 33croston .. 34CV .. 36 CVar .. 38dshw .. 40easter .. 42ets .. 43findfrequency .. 46forecast .. 55 Rtopics .. 73fourier .. 75gas .. 76getResponse .. 77gghistogram .. 78gglagplot .. 79ggmonthplot .. 81ggseasonplot .. 82ggtsdisplay .. 83gold .. 87ma .. 87meanf .. 88modelAR .. 90monthdays .. 92mstl .. 93msts .. 95ndiffs .. 96nnetar .. 97nsdiffs .. 109rwf .. 110seasadj .. 113seasonal .. 114seasonaldummy .. 115ses .. 119sindexf .. 122splinef .. 123 StatForecast .. 127taylor .. 129tbats .. 131thetaf .. 132tsclean .. 134tsCV .. 135tslm .. 136tsoutliers .. 137wineind .. 138woolyrnq .. 139 Index140forecast-packageForecasting Functions for time series and Linear ModelsDescriptionMethods and tools for displaying and analysing univariate time series forecasts including exponen-tial smoothing via state space models and automatic ARIMA :forecastType:PackageLicense:GPL3 LazyLoad:yesAuthor(s)Rob J HyndmanMaintainer: measures for a forecast modelDescriptionReturns range of summary measures of the forecast accuracy.

3 Ifxis provided, the function measurestest set forecast accuracy based onx-f. Ifxis not provided, the function only produces trainingset accuracy measures of the forecasts based onf["x"]-fitted(f). All measures are defined anddiscussed in Hyndman and Koehler (2006).accuracy5 Usageaccuracy(object, ..)## Default S3 method:accuracy(object, x, test = NULL, d = NULL, D = NULL, f = NULL, ..)ArgumentsobjectAn object of class forecast , or a numerical vector containing forecasts. Itwill also work withArima,etsandlmobjects ifxis omitted in which casetraining set accuracy measures are arguments depending on the specific optional numerical vector containing actual values of the same length asobject, or a time series overlapping with the times of which elements ofxandfto test. IftestisNULL, all elements areused. Otherwise test is a numeric vector containing the indices of the elementsto use in the integer indicating the number of lag-1 differences to be used for the denom-inator in MASE calculation.

4 Default value is 1 for non-seasonal series and 0 forseasonal integer indicating the number of seasonal differences to be used for the de-nominator in MASE calculation. Default value is 0 for non-seasonal series and1 for seasonal Please use object measures calculated are: ME: Mean Error RMSE: Root Mean Squared Error MAE: Mean Absolute Error MPE: Mean Percentage Error MAPE: Mean Absolute Percentage Error MASE: Mean Absolute Scaled Error ACF1: Autocorrelation of errors at lag default, the MASE calculation is scaled using MAE of training set naive forecasts for non-seasonal time series , training set seasonal naive forecasts for seasonal time series and training setmean forecasts for non- time series data. Iffis a numerical vector rather than aforecastobject,the MASE will not be returned as the training data will not be Hyndman and Koehler (2006) and Hyndman and Athanasopoulos (2014, Section ) for giving forecast accuracy (s)Rob J HyndmanReferencesHyndman, and Koehler, (2006) "Another look at measures of forecast accuracy".

5 Inter-national Journal of forecasting ,22(4), 679-688. Hyndman, and Athanasopoulos, G. (2018)" forecasting : principles and practice", 2nd ed., OTexts, Melbourne, Australia. Section "Evalu-ating forecast accuracy". <- rwf(EuStockMarkets[1:200, 1], h = 100)fit2 <- meanf(EuStockMarkets[1:200, 1], h = 100)accuracy(fit1)accuracy(fit2)accuracy (fit1, EuStockMarkets[201:300, 1])accuracy(fit2, EuStockMarkets[201:300, 1])plot(fit1)lines(EuStockMarkets[1:300, 1])Acf(Partial) Autocorrelation and Cross-Correlation Function EstimationDescriptionThe functionAcfcomputes (and by default plots) an estimate of the autocorrelation function of a(possibly multivariate) time series . FunctionPacfcomputes (and by default plots) an estimate ofthe partial autocorrelation function of a (possibly multivariate) time series . FunctionCcfcomputesthe cross-correlation or cross-covariance of two univariate (x, = NULL,type = c("correlation", "covariance", "partial"),plot = TRUE, = ,demean = TRUE.)

6 Acf7 Pacf(x, = NULL,plot = TRUE, = ,demean = TRUE,..)Ccf(x,y, = NULL,type = c("correlation", "covariance"),plot = TRUE, = ,..)taperedacf(x, = NULL,type = c("correlation", "partial"),plot = TRUE, = TRUE,level = 95,nsim = 100,..)taperedpacf(x, ..)Argumentsxa univariate or multivariate (not Ccf) numeric time series object or a numericvector or lag at which to calculate the acf. Default is $10*log10(N/m)$ where$N$ is the number of observations and $m$ the number of series . Will be auto-matically limited to one less than the number of observations in the string giving the type of acf to be computed. Allowed values are correlation (the default), covariance or partial .plotlogical. IfTRUE(the default) the resulting acf, pacf or ccf is to handle missing values. Default Useful alterna-tives covariances be about the sample means?..Additional arguments passed to the plotting univariate numeric time series object or a numeric , confidence intervals for the ACF/PACF estimates are level used for the confidence number of bootstrap samples used in estimating the confidence functions improve theacf,pacfandccffunctions.

7 The main differences are thatAcfdoesnot plot a spike at lag 0 whentype=="correlation"(which is redundant) and the horizontal axesshow lags in time units rather than seasonal tapered versions implement the ACF and PACF estimates and plots described in Hyndman(2015), based on the banded and tapered estimates of autocovariance proposed by McMurry andPolitis (2010).ValueTheAcf,PacfandCcffunctions return objects of class "acf" as described inacffrom the statspackage. Thetaperedacfandtaperedpacffunctions return objects of class "mpacf".Author(s)Rob J HyndmanReferencesHyndman, (2015). Discussion of High-dimensional autocovariance matrices and optimal lin-ear prediction .Electronic Journal of Statistics, 9, , T. L., & Politis, D. N. (2010). Banded and tapered estimates for autocovariance matricesand the linear process of time series Analysis, 31(6), Alsoacf,pacf,ccf,tsdisplayExamplesAcf(wi neind)Pacf(wineind)## Not run:taperedacf(wineind, nsim=50)taperedpacf(wineind, nsim=50)## End(Not run)arfima9arfimaFit a fractionally differenced ARFIMA modelDescriptionAn ARFIMA(p,d,q) model is selected and estimated automatically using the Hyndman-Khandakar(2008) algorithm to select p and q and the Haslett and Raftery (1989) algorithm to estimate theparameters including (y,drange = c(0, ),estim = c("mle", "ls"),model = NULL,lambda = NULL,biasadj = FALSE,x = y.)

8 Argumentsya univariate time series (numeric vector).drangeAllowable values of d to be considered. Default ofc(0, )ensures a station-ary model is "ls", then the ARMA parameters are calculated using the Haslett-Raftery algorithm. Ifestim=="mle", then the ARMA parameters are calculatedusing full MLE via from a previous call toarfima. If model is passed, this same model isfitted to y without re-estimating any transformation parameter. Iflambda="auto", then a transformation isautomatically selected The transformation is ignored ifNULL. Otherwise, data transformed before model is adjusted back-transformed mean for Box-Cox transformations. If trans-formed data is used to produce forecasts and fitted values, a regular back trans-formation will result in median forecasts. If biasadj is TRUE, an adjustment willbe made to produce mean forecasts and fitted Included for backwards arguments passed selecting p and function automatically select and estimate an ARFIMA model.

9 The fractional differencing parameter is chosen first assuming an ARFIMA(2,d,0) the data are fractionally differenced using the estimated d and an ARMA model is selected forthe resulting time series Finally, the full ARFIMA(p,d,q) model is re-estimatedusingfracdiff. Ifestim=="mle", the ARMA coefficients are refined list object of S3 class"fracdiff", which is described in thefracdiffdocumentation. A fewadditional objects are added to the list includingx(the original time series ), and (s)Rob J Hyndman and Farah YasmeenReferencesJ. Haslett and A. E. Raftery (1989) Space- time Modelling with Long-memory Dependence: As-sessing Ireland s Wind Power Resource (with discussion);Applied Statistics38, , and Khandakar, Y. (2008) "Automatic time series forecasting : The forecast packagefor R",Journal of Statistical Software,26(3).See Alsofracdiff, , (fracdiff)x <- ( 100, ma= , d=.3)$seriesfit <- arfima(x)tsdisplay(residuals(fit))ArimaF it ARIMA model to univariate time seriesDescriptionLargely a wrapper for thearimafunction in the stats Package .

10 The main difference is that thisfunction allows a drift term. It is also possible to take an ARIMA model from a previous call toArimaand re-apply it to the (y,order = c(0, 0, 0),seasonal = c(0, 0, 0),xreg = NULL, = TRUE, = FALSE, ,lambda = model$lambda,biasadj = FALSE,method = c("CSS-ML", "ML", "CSS"),model = NULL,x = y,..)Argumentsya univariate time series of specification of the non-seasonal part of the ARIMA model: the three com-ponents (p, d, q) are the AR order, the degree of differencing, and the MA specification of the seasonal part of the ARIMA model, plus the period (whichdefaults to frequency(y)). This should be a list with components order and pe-riod, but a specification of just a numeric vector of length 3 will be turned into asuitable list with the specification as the , a numerical vector or matrix of external regressors, which must havethe same number of rows as y. It should not be a data the ARIMA model include a mean term? The default isTRUEfor undif-ferenced series ,FALSEfor differenced ones (where a mean would not affect thefit nor predictions).


Related search queries