Incremental ("online") computation of the root-mean-squared-error (RMSE) for a linear regression

300 Views Asked by At

I've been able to calculate a least squares linear regression's slope incrementally. (https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Covariance shows one-pass "online" methods for calculating the covariance and you can find others for the variance. Dividing the covariance by the variance yields the slope, m.)

However, now I want to know the error of the line's slope. I'm not sure how to calculate this since each residual is calculated by taking its distance from the least squares line, which changes with each addition of new point, and thus should change the previously calculated error.