Description Usage Arguments Value Examples
View source: R/deseasonalize.R
This function deseasonalizes a time series using the "multiplicative" decomposition only.
1 | deseason(ts.data, ts.frequency, forecast.horizon, alpha.level = 0.05)
|
ts.data |
A ts object (i.e., a vector of time series observations). |
ts.frequency |
The frequency of a ts object. |
forecast.horizon |
Number of periods for forecasting. |
alpha.level |
The alpha level to be used in the test to detect seasonality. Default is 0.05. |
A list with the deseasonalized data ("deseasonTS"
) and the
seasonal component ("seasonalComp"
).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # Example using a TS with frequency > 1 (in this case, frequency = 12)
tmpAir <- deseason(
ts.data = datasets::AirPassengers,
ts.frequency = stats::frequency(datasets::AirPassengers),
forecast.horizon = 20
)
head(datasets::AirPassengers) # original data
head(tmpAir$deseasonTS) # deseasonalized series w/o multiplicative
# component, not equal to the original
head(tmpAir$deseasonTS * tmpAir$seasonalComp) # this should be equal to the
# original data
# Example using a TS with frequency = 1
tmpUsage <- deseason(
ts.data = datasets::WWWusage,
ts.frequency = stats::frequency(datasets::WWWusage),
forecast.horizon = 10
)
head(datasets::WWWusage) # original data
head(tmpUsage$deseasonTS) # since frequency = 1, results should be the same
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.