Every window counts raw observations, including the levels needed to form differences and lags. Submit observations in time order at the sampling frequency of the model. A missing calendar interval is not imputed. Rejecting a nonfinite observation raises ValueError before it enters the window. Dimensions, lag orders and deterministic terms are constructor choices. Python None is not a numeric input.
Call update(...) to ingest and read the result, or advance(...) to ingest without producing a Python result. last() reads the current estimate, and may calculate a complete fit. The read-only ready property reports whether the sample is full, even if the result is undefined. Before a full window, both result-returning methods return None. Cumulative DW becomes ready on the second observation. reset() restores the initial state. Multiple reads have no effect on subsequent observations. Full-window tests with an unidentified statistic return a native result with statistic is None. Inspect the regression rank and observation count; a missing p-value or empty critical-value list means calibration is unavailable. Keep inputs and their products within floating-point range.
Regression and calibration conventions
regression="none" omits deterministic columns. "constant" includes an intercept. "trend" adds an intercept and a linear trend. Coefficients, standard errors and t ratios are in deterministic-column order followed by the documented predictors. Time runs from one through the number of usable regression rows. The intercept refers to time zero. The model with a trend refits the trend within each window.
OLSResult contains nobs, rank, coefficients, intercept, standard_errors, t_statistics, rss, tss, residual_variance, r_squared and adjusted_r_squared. Errors are homoskedastic OLS standard errors. Residual variance is RSS/(n−p) for a full-rank p-column design. TSS is centered with an intercept and uncentered otherwise. R² = 1−RSS/TSS. Adjusted R² replaces RSS and TSS with their respective mean squares, dividing TSS by n−1 with an intercept and n otherwise. Zero TSS gives an undefined R². A zero standard error gives an undefined (NaN) coefficient t ratio. Rank deficiency returns rank and nobs with empty parameter vectors. Conditional ECM and selected-regime standard errors do not account for first-stage estimation or threshold selection.
Fits center data at a real observation when fitting an intercept and scale columns before column-pivoted Householder QR. Rank uses a relative diagonal threshold of machine epsilon times the larger design dimension. Standard errors use triangular solves for coefficient contrasts. Rolling QR inserts rows with Givens rotations. At each window revolution it rebuilds the factors of outgoing suffixes at block boundaries from retained rows. Expiration chooses the surviving suffix and combines it with the partial block and incoming factor. This avoids subtractive downdates near loss of rank. A severe level shift triggers a centered fit on the raw rows. Numerical rank and inference close to perfect fits are sensitive to floating-point precision.
Test critical values are in 1%, 5%, 10% order. ADF and EG use MacKinnon's 1994 asymptotic normal-response-surface p-values and 2010 finite-sample critical-value polynomials as tabulated in statsmodels. PP uses the ADF tau calibration. Null distributions depend on deterministic terms and the number of stochastic series. For EG the p-value tables cover two through six stochastic series. The finite-sample critical values cover two through twelve series when deterministic terms are included. KPSS and CRDW provide tabulated thresholds only. Johansen returns a row of thresholds per rank. The threshold unit-root procedure simulates its own finite-sample null. Each p-value describes a single prespecified window and model.
Building blocks
rtta.log_transform(x) computes the natural logarithm of a finite positive input. For scalar streaming differences RTTA already provides Momentum(window=1, fillna=False). Native batch refits form adjacent differences directly. rtta.autocorrelation(values, lag) divides the demeaned lagged product sum by total squared deviations, with both covariance estimates using divisor n. A constant series gives None. PP and KPSS use uncentered score products after nuisance regression, with Bartlett weights 1−h/(b+1), h=1,…,b. Both maintain lagged cross-products and reconstruct them periodically. Simulation and regression dimensions are limited by available memory and by the sample degrees of freedom. Published tables cover only their documented dimensions.
The independent comparisons are in test_econometrics.py. Install the econometrics-tests project extra for the statsmodels and arch oracles. The benchmark times Python update calls including result creation. Benchmark measurements
Reference comparison
On the arm64 release build, 32 independent 96-row, three-series Gaussian random walks gave the following maximum absolute differences in the statistics. NumPy 2.5.5 generated successive increments using default_rng(137).normal(size=(96, 3)), cumulatively summed down rows. The comparisons use the first series for scalar tests, the first two for EG, and all three for Johansen. These are observed differences on this sample.
| Statistic | Reference and specification | Maximum absolute difference |
|---|---|---|
| ADF | statsmodels 0.15.0, trend, three fixed lags | 1.47 × 10⁻¹⁴ |
| EG | statsmodels 0.15.0, constant, two fixed lags | 2.23 × 10⁻¹⁵ |
| PP Zτ | arch 9.0.0, constant, Bartlett bandwidth four | 3.02 × 10⁻¹⁴ |
| KPSS | statsmodels 0.15.0, constant, Bartlett bandwidth four | 3.86 × 10⁻¹⁴ |
| Johansen trace, all ranks | statsmodels 0.15.0, constant, two lagged differences | 1.43 × 10⁻¹³ |
