About this question
Hard · time_series · Quant Researcher interview question · recursive_least_squares, online_learning, forgetting_factor, time_varying_beta, time_series
Recursive Least Squares (RLS) is an adaptive algorithm for estimating the parameters of a linear model as new data arrives. It is widely used in quantitative finance for tracking time-varying factor exposures in risk systems, as it can efficiently update estimates with each observation. A forgetting factor, λ, allows the model to downweight older data, enabling rapid adaptation to regime shifts. Task Implement the function recursive_least_squares(X, y, lam=1.0, delta=1000.0) to fit a linear mod