---
title: "smooth: forecasting using state-space models"
author: "Ivan Svetunkov"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{smooth}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r global_options, include=FALSE}
knitr::opts_chunk$set(fig.width=6, fig.height=4, fig.path='Figs/', fig.show='hold',
                      warning=FALSE, message=FALSE)
```

This vignette explains how to use functions in 'smooth' package, what they produce, what each field in outputs and what returned values mean. Underlying statistical models are not discussed here, but if you want to know more about them, then there is a document "[Statistical models underlying functions of 'smooth' package for R](https://github.com/config-i1/smooth/blob/master/inst/doc/smooth-Documentation.pdf)".

The package includes the following functions:

1. [es() - Exponential Smoothing](es.html);
2. [ssarima() - State-Space ARIMA](ssarima.html), also known as Several Seasonalities ARIMA;
3. [ces() - Complex Exponential Smoothing](ces.html);
4. [ges() - Generalised Exponential Smoothing](ges.html);
5. [sma() - Simple Moving Average in state-space form](sma.html);
6. [sim.es() and simulate() - simulation functions for Exponential Smoothing](simulate.html).

This funcions (except for the last one) return object of class "smooth", which uses several methods.

## Methods for the class `smooth`

There are several functions that can be used together with `es()`, `ces()`, `ssarima()` and `ges()` functions. So when a model is saved to some object `ourModel`, these function will do some things. Here's the list of all the available methods with some explanations:

1. `summary(ourModel)` -- function prints brief output with explanation of what was fitted, with what parameters and errors;
2. `fitted(ourModel)` -- fitted values;
3. `forecast(ourModel)` -- point and interval forecasts. This is needed for compatibility with Rob Hyndman's "forecast" package. `forecast(ourModel)` returns object of class `forecastSmooth`;
4. `residuals(ourModel)` -- residuals of constructed model;
5. `AIC(ourModel)`, `BIC(ourModel)` and `AICc(ourModel)` -- information criteria of the constructed model. `AICc()` function is not a standard ``stats'' function and is introduced by ``smooth'';
6. `plot(ourModel)` -- plots states of constructed model. If number of states is higher than 10, then several graphs are produced;
7. `simulate(ourModel)` -- produces data simulated from provided model. Currently only available for ETS via `simulate(es(...))`;
8. `summary(forecast(ourModel))` -- prints point and interval forecasts;
9. `plot(forecast(ourModel))` -- produces graph with actuals, forecast, fitted and intervals using `graphmaker()` function.

