Description Usage Arguments Examples
Exponential smoothing of (possibly non-equidistant) time series.
1 2 3 4 5 |
yvar |
Time series, a numeric vector. |
tvar |
Time variable, a numeric vector. Defaults to 1, 2, ... |
alpha |
Smoothing parameter; if NULL, alpha will be estimated by minimizing a prediction error. |
init |
Intial value for the first smoothed value; defaults to the average of the first three observations. |
fit |
Should smoothing parameter be fitted to data? |
filter. |
Experimental feature, please do not use. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | yvar <- aggregate(co2)
tvar <- seq_along(yvar)
f1 <- ses(yvar, tvar)
f2 <- des(yvar, tvar)
at <- 1 + seq(0, 35, by=5)
par(mfrow=c(2,1))
plot(f1)
forecast_lines(f1, at=at, ahead=0:5, col='red', lwd=3)
forecast_lines(f2, at=at, ahead=0:5, col='blue', lwd=3)
## Add more noise
yvar2 <- yvar + rnorm(length(yvar), sd=40)
f1 <- ses(yvar2, tvar)
f2 <- des(yvar2, tvar)
plot(f1)
at <- 1 + seq(0, 35, by=5)
forecast_lines(f1, at=at, ahead=0:5, col='red', lwd=3)
forecast_lines(f2, at=at, ahead=0:5, col='blue', lwd=3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.