gs_quant.timeseries.technicals.seasonally_adjusted¶
- seasonally_adjusted(x, method=SeasonalModel.ADDITIVE, freq=Frequency.YEAR)[source]¶
Seasonally adjusted series
- Parameters:
x (
Series
) – time series with at least two years worth of data.method (
SeasonalModel
) – ‘additive’ or ‘multiplicative’. Type of seasonal model to use. ‘multiplicative’ is appropriate when the magnitude of the series’s values affect the magnitude of seasonal swings; ‘additive’ is appropriate when seasonal swings’ sizes are independent of the series’s values.freq (
Frequency
) – ‘year’, ‘quarter’, ‘month’, or ‘week’. Period in which full cycle occurs (i.e. the “period” of a wave).
- Return type:
Series
- Returns:
date-based time series of seasonally-adjusted input series.
Usage
Uses a centered moving average and convolution to decompose the input series into seasonal, trend, and residual components. This function returns the series with the seasonal component removed.
If using the default additive model:
\(Y_t = X_t - S_t\)
If using the multiplicative model:
\(Y_t = X_t / S_t\)
Examples
Generate price series and compute seasonally-adjusted series.
>>> prices = generate_series(1000) >>> seasonally_adjusted(prices)
See also