Rolling two-step conditional bivariate error-correction regression.
Refit the levels equation y = D + βx + e in the current window. Estimate Δyₜ = a + αeₜ₋₁ + bΔxₜ + Σⱼ(cⱼΔyₜ₋ⱼ+dⱼΔxₜ₋ⱼ) + uₜ, with L fixed lag pairs. Return the levels fit and short-run OLS diagnostics. Coefficient 1 is the adjustment α, coefficient 2 is the contemporaneous Δx slope, followed by alternating lagged Δy and Δx slopes. n=w−1−L. This conditional model presumes an economically meaningful equilibrium relation and weakly exogenous x for the conditional interpretation. Generated-regressor SEs condition on the levels fit. Each read refits both equations. Ingest O(1), read O(wk²+k³), temporary storage O(wk+k²) with k=3+2L. Compared with two independent NumPy lstsq fits.
The econometric conventions specify input validation, warm-up, reset, result fields, numerical rank and critical-value order.
Python example
import random
import rtta
rng = random.Random(42)
model = rtta.ErrorCorrectionModel(window=64, lags=1)
for i in range(64):
value = rng.gauss(0, 1)
predictor = rng.gauss(0, 1)
result = model.update(value, predictor)
print(result.regression.coefficients)
Reference
Engle and Granger (1987), Co-integration and Error Correction: Representation, Estimation, and Testing.
