Description Usage Arguments Value Author(s) See Also Examples
This function checks a time series for seasonality using three different approaches:
'pgram'
computes a periodogram using fast fourier transformation (spec.pgram
) and checks at which frequency the periodogram has a maximum. A maximum at a frequency of 1 indicates seasonality and the function returns TRUE.
'acf'
computes the auto-correlation function of the de-trended time series using acf
. A minimum acf value at a lag of 0.5 indicates seasonality and the function returns TRUE.
'lm'
fits two linear models to the time series. The first model includes the trend and the seasonal cycle as factorial variable. The second model includes only the trend. Based on the BIC
the better model is selected and the function returns TRUE if the first model (including a seasonal term) is better.
1 2 | Seasonality(Yt, return.freq = FALSE,
plot = FALSE, ...)
|
Yt |
univariate time series of class |
return.freq |
if |
plot |
|
... |
further arguments (currently not used) |
The function returns a boolean vector of length 3 including TRUE if a method detected seasonality or FALSE if a method did not detect seasonality.
Matthias Forkel <matthias.forkel@tu-dresden.de> [aut, cre]
spec.pgram
, acf
, lm
, BIC
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # load a time series of NDVI (normalized difference vegetation index)
# time series with strong Seasonality:
Yt <- SimTs(Srange = 0.2, Tslope=c(0.0004, 0))[,1]
plot(Yt)
Seasonality(Yt)
# time series with Seasonality and some noise
Yt <- SimTs(Srange = 0.1, Tslope=c(0.0004, 0), Rsd=0.18, Rrange=0.25)[,1]
plot(Yt)
Seasonality(Yt)
# time series with Seasonality but many noise
Yt <- SimTs(Srange = 0.1, Tslope=c(0.0004, 0), Rsd=0.22, Rrange=0.4)[,1]
plot(Yt)
Seasonality(Yt)
# time series without Seasonality
Yt <- SimTs(Srange = 0.01, Tslope=c(0.0004, 0), Rsd=0.2, Rrange=0.4)[,1]
plot(Yt)
Seasonality(Yt)
# plot results for each seasonality method
Yt <- SimTs(Srange = 0.1, Tslope=c(0.0004, 0), Rsd=0.18, Rrange=0.25)[,1]
Seasonality(Yt, plot=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.