The set of smoothing functions used for time series analysis and in forecasting. Currently the package includes exponential smoothing models and SARIMA in state-space form + several simulation functions.

The package *smooth* contains several smoothing (exponential and not) functions that are used in forecasting.

Here is the list of included functions:

- es - the ETS function. It can handle exogenous variables and has a handy "holdout" parameter. There are several cost function implemented, including trace forecast based ones. Model selection is done via branch and bound algorithm and there's a possibility to use AIC weights in order to produce combined forecasts. Finally, all the possible ETS functions are implemented here.
- ces - Complex Exponential Smoothing. Function estimates CES and makes forecast. See documentation for details.
- ges - Generalised Exponential Smoothing. Next step from CES. The paper on this is in the process.
- ssarima - SARIMA estimated in state-space framework. Allows multiple seasonalities.
- auto.ces - selection between seasonal and non-seasonal CES models.
- auto.ssarima - selection between different State-Space ARIMA models.
- sim.es - simulation of data using ETS framework with a predefined (or random) smoothing parameters and initial values.
- sim.ssarima - simulation of data using State-Space ARIMA framework with a predefined (or randomly generated) parameters and initial values.
- sim.ces - simulation of data using CES with a predefined (or random) complex smoothing parameters and initial values.
- sma - Simple Moving Average in state-space form.
- iss - Intermittent data state-space model. This function models the part with data occurrences using one of three methods: Croston's, TSB and fixed probability.

Future works:

- sim.ges - simulation functions for GES.
- cma - Centred Moving Average. This should be based on sma(), but would be available for time series decomposition.
- auto.ges - Automatic selection of the most appropriate GES model.
- nus - Non-uniform Smoothing. The estimation method used in order to update parameters of regression models.
- sofa.ts - Survival of the fittest algorithm applied to state-space models.

The stable version of the package is available on CRAN, so you can install it by running:

A recent, development version, is available via github and can be installed using "devtools" in R. Firstly make sure that you have devtools:

if (!require("devtools")){install.packages("devtools")}

and after that run:

devtools::install_github("config-i1/smooth")

The package depends on Rcpp and RcppArmadillo, which will be installed automatically.

However Mac OS users may need to install gfortran libraries in order to use Rcpp. Follow the link for the instructions: http://www.thecoatlessprofessor.com/programming/rcpp-rcpparmadillo-and-os-x-mavericks-lgfortran-and-lquadmath-error/

Sometimes after upgrade of smooth from previous versions some functions stop working. This is because C++ functions are occasionally stored in deeper unknown coners of R's mind. Restarting R usually solves the problem.

Changes:

- Instead of having dozens of methods based on AIC and BIC, we now have logLik, nobs and AICc.default. The latter should also work with other, non smooth, classes (e.g. "ets","lm").
- sim functions now return likelihood via logLik value rather than "likelihood". This allows using logLik, AIC and other functions.
- iss function now also does the same...
- Introduced "SBA" as a separate method for intermittent demand.

Bugfixes:

- Parametric prediction intervals for iSS models always had width of 95%. This is now fixed.
- Corrected bug in Croston's iSS, where the last observation of data was included as non-zero demand.
- Fixed a bug when MNN was fit to intermittent data without intermittency.

Changes:

- Now you can produce 0-steps ahead forecasts using smooth functions. Pretty cool, ah? And pretty useless for my taste. But here it is!
- iprob in sim functions now also accepts a vector, implying that probability may vary over time in style of TSB and Croston's method.

Bugfixes:

- intermittent data was not taken correctly into account in number of parameters calculation in functions.
- Fixed a bug with persistence not accepting matrices in es()
- persistence now looks nice in the output of sim.es()
- sim.ssarima() had a bug with array not becoming a matrix. Nailed it!

Changes:

- auto.ssarima() now allows combining forecasts using IC weights. This is a first try. Prediction intervals for the combined model are currently incorrect.
- Made important changes to initialisation of SARIMA and some tuning in backcasting mechanism.
- Some tuning in sim functions in parts with ellipsis checks.
- sim.ssarima() now accepts orders as list. This should be handy when doing sim.ssarima(orders=orders(ourModel)). No need to define each order separately anymore.
- ssarima() also accepts orders as list. No need to specify separate ar.orders, ma.orders and i.orders (they are now optional) if you want to extract value from another model. Plus it is handy just to write orders=list(ar=1,i=1,ma=c(1,2,3)).
- auto.ssarima() now also uses orders as a list variable instead of ar.max, i.max and ma.max.
- sim.ssarima() now uses burn-in period if the initials were generated.
- Uodated manuals, so they are a bit more consistent.
- Got rid of silent parameter in sim functionst, because all the info they give needs to be put in warnings.
- sim functions now print proper warnings.
- Tuned initial values of es(). This should be helpfull in cases with backcasting of initials.
- Optimised auto.ssarima() mechanism. Not faster, but more accurate.

Bugfixes:

- sim.ssarima() wouldn't work in cases of ARIMA(0,0,0) with/without constant.
- polynomials were multiplied inccorectly in cases of ARIMAs with d>1.
- Fixed a bug with phiEstimate not beeing used correctly.

Changes:

- New function - sim.ces(), that generates data from CES model with predefined parameters.
- Due to (1) simulate.smooth() now also works with CES.
- modelType() in cases of ces() now returns the full name of model instead of the first letter.
- auto.ces() has now a smaller pool of models: "none", "simple" and "full".

Bugfixes:

- Fixed problem with xreg length and provided initialX (issue #59 on github).
- Fixed a check of models pool in auto.ces().

Changes:

- New function - sim.ssarima() that allows generating data from any ARIMA with any provided parameters.
- New methods for smooth class: lags, orders and modelType. First two are for ssarima(), ges() and sma(), the last one is for es(), ces() and ets() from "forecast" package.
- Introduced new class for simulation functions, "smooth.sim" and created print and plot methods for them.
- es() now accepts "XXX" as model. This allows excluding multiplicative components from the pool. This does not use branch and bound. So model="ZXZ" will go through all the models with T="N", T="A" and T="Ad".
- Similarly es() can now select the most appropriate non-additive model. This is regulated with: model="YYY".

Minor changes:

- Updated print for "smooth" class for es() and ges(): now we produce a nice vector with names of smoothing parameters.
- simulate.smooth() method update in order to take sim.ssarima() into account.
- AICc now also extracts AICc from ets() of "forecast" package.

Bugfixes:

- Fixed a bug with provided model with damped trend.
- Fixed a bug in pool of models with damped trend ("ZAdZ").

Changes:

- Parameter intervals now accepts type of interval instead of intervalsType.
- Polynomials of ssarima() are now multiplied in C++. Initialisation is now done there as well. This slightly speeds up the estimation and construction of SSARIMA.

Bugfixes:

- Fixed names of returned smoothing parameters by es().

Changes:

- auto.ssarima() function uses now a different algorithm. This allows speeding up order selection process and selecting models closer to the "true" one.
- Some corrections in smooth-Documentation.
- Package will now tell its version when loaded.

Bugfixes:

- Corrected C++ bug that caused problems on Solar OS.

Changes:

- Removed "TFL" as a cost function type and "asymmetric" as intervals type. The functions still accept these parameters, but the parameters are now hidden, because currently they are not ready for wide audience.
- Changed how number of parameters is calculated when initials are provided. They should be counted in. Only backcasting now excludes initials in calculation of number of parameters.
- Prepared vignette for es(), ces(), ssarima(), ges(), sma() and sim.es(). This now includes examples with some comments.
- Uploaded documentation for the package to github (https://github.com/config-i1/smooth/smooth.pdf). This will be published as working paper and will be available via ResearchGate.

Bugfixes:

- Fixed a bug with intervalsType="s" not working for auto functions.
- data provided to auto functions is now checked.

Changes:

- We now use vignettes, explaining how to work with functions and what they return. This is just a start of the work. Vignettes will be updated. There is also a work on documentation for models underlying smooth package. This is currently reviewed and will be available as a working paper soon.
- New function - sma() - Simple Moving Average. It fits one as a state-space model. So, apparantely there is a model underlying simple moving average method...
- Named transitionX and persistenceX are now returned, when using exogenous variables are used with updateX=TRUE. This should simplify the analysis of these matrices.

Bugfixes:

- A fix for plot(es(...)) in case of inclusion of exogenous variables leading to states containing more than 10 columns.
- Warnings are now always printed out for unstable SSARIMA.

Changes:

- We now suggest testthat package and do more extensive tests in order to make sure that everything works as it should.
- Introduced parameters A and B in ces() function.
- Got rid of parameter C in ces() function.

Bugfixes:

- ssarima() could not construct ARIMA(0,1,0) without constant. Fixed that.

Changes:

- Started this NEWS file.
- Fixed a bug with ssarima() not accepting previously estimated models in cases with constant=TRUE.
- Removed NUS and sim.ces. They will return when they are in a better condition.