incline.trend_with_deseasonalization¶
- incline.trend_with_deseasonalization(df, smoother=None, column_value='value', time_column=None, method='auto', period=None, n_bootstrap=100, random_state=None, **fit_kwargs)[source]¶
Deseasonalize, then estimate the trend of what is left.
A convenience wrapper over
estimate(smoother, deseasonalize(df)). Takes aSmootherrather than a method name, so it works with every estimator without a dispatch table.With
se=Truethe uncertainty accounts for the seasonal fit as well as the trend fit. It has to: the cycle was estimated from the same data, and treating it as known makes the interval about 10% too narrow – coverage 0.917 against a nominal 0.95. So the standard error comes from bootstrapping the whole pipeline, resampling the decomposition’s residuals and redoing the decomposition and the trend fit together, which brings coverage to 0.983.That costs
n_bootstrapdecompositions, which is the price of an honest number and is only paid when a standard error is asked for. If you want the cheap interval that treats the adjusted series as data, compose the two steps yourself:adjusted = deseasonalize(df) result = sgolay_trend(adjusted, column_value="deseasonalized", se=True)
which says plainly what it assumes.
- Parameters:
df (pd.DataFrame) – Time series data.
smoother (Smoother | None) – Estimator to run. Penalized spline by default.
column_value (str) – Column holding the values.
time_column (str | None) – Numeric time column.
method (str) – Decomposition method; see
deseasonalize().period (int | None) – Cycle length. Detected when None.
n_bootstrap (int) – Replicates used to propagate the decomposition.
random_state (int | np.random.Generator | None) – Seed or Generator for the bootstrap.
**fit_kwargs (Any) – Passed through to the estimator, e.g.
se=True.
- Returns:
The estimator’s usual columns plus
DECOMPOSITION_COLUMNS. One schema, whether or not a cycle was found.- Return type:
pd.DataFrame