API reference

Generated from the source, so it cannot drift from what the package actually exports.

Estimating a trend

The functional surface. Each builds a smoother, fits it, and returns a DataFrame carrying the columns described in Uncertainty.

naive_trend

Estimate the trend by central finite differences.

sgolay_trend

Estimate the trend with a Savitzky-Golay filter.

spline_trend

Estimate the trend with a knot-selecting smoothing spline.

pspline_trend

Estimate the trend with a penalized smoothing spline.

loess_trend

Estimate the trend with LOESS.

local_polynomial_trend

Estimate the trend by local polynomial regression.

l1_trend_filter

Estimate a piecewise-polynomial trend with sparse changes in slope.

gp_trend

Estimate the trend with Gaussian process regression.

kalman_trend

Estimate the trend with a local linear trend state-space model.

estimate_trend

Estimate a trend, choosing the method automatically if asked.

select_trend_method

Recommend a smoother for a series.

estimate

Run a smoother over a DataFrame and return the structured estimate.

Smoothers

The objects behind those functions. Use these directly when you want to hand one to SiZer, to trend_with_deseasonalization, or to estimate.

Whether a smoother is linear decides how its uncertainty is computed: linear smoothers get an exact operator variance, the rest are bootstrapped.

Smoother

Base class for every trend estimator.

SavitzkyGolay

Savitzky-Golay filter: local polynomial least squares on a fixed window.

NaiveDifference

Central finite differences on the raw series.

LocalPolynomial

Local polynomial regression with kernel weights.

Loess

LOESS smoothing, then a local polynomial fit to the smooth.

PenalizedSpline

Smoothing spline with a fixed roughness penalty.

InterpolatingSpline

Smoothing spline that chooses its own knots.

L1TrendFilter

L1 trend filtering: piecewise-polynomial fit with sparse kinks.

GaussianProcess

Gaussian process regression with an exact derivative posterior.

StateSpace

Local linear trend, optionally with seasonal and damping.

build

Construct a smoother by name.

incline.SMOOTHERS is the registry those names are looked up in: a mapping from name to class. build(name, **kwargs) constructs from it, and estimate_trend(method=...) dispatches through it, so a newly registered smoother is reachable everywhere without editing a dispatch table.

Noise models

What noise= accepts. The default assumes independence; under real autocorrelation that understates the uncertainty substantially.

NoiseModel

Base class for noise specifications.

IID

Independent noise with constant variance.

AR1

First-order autoregressive noise.

Heteroskedastic

Independent noise whose scale changes across the series.

Given

A caller-supplied noise covariance, used exactly as provided.

local_sigma

Estimate a noise level that varies across the series.

Results

TrendEstimate

A smoothed series and the derivative of that smooth, with uncertainty.

TimeAxis

Numeric time positions for a series.

Multi-scale analysis

Which features survive being looked at from every smoothing scale.

SiZer

A scale sweep over any smoother.

SiZerMap

The result of a scale sweep.

sizer_analysis

Run a scale sweep in one call.

trend_with_sizer

Estimate a trend and mark where it survives a scale sweep.

Seasonality

Decomposition is preprocessing: deseasonalize returns a frame, which any estimator then accepts.

deseasonalize

Split a series into trend, cycle and remainder.

detect_seasonality

Look for a repeating cycle, by three methods in decreasing reliability.

stl_decompose

Seasonal-trend decomposition by LOESS.

moving_average_decompose

Classical decomposition by a centered moving average.

trend_with_deseasonalization

Deseasonalize, then estimate the trend of what is left.

Seasonality

What was found when looking for a cycle.

Ranking many series

trending

Rank series by recent trend strength.

Simulation

Synthetic series with known derivatives, used by the package’s own calibration tests and available for yours.

generate_time_series

Simulate a series from a known trend.

standard_test_functions

A spread of trends covering the shapes estimators handle differently.