I am sampling from a random process $X$ and I would like to calculate $R^2$ for the cumulative sum of the samples: $$x_1,..x_n$$ $$y_n=\sum_0^n x_i$$
$$R^2_n=RSQ( [1,2,...n], [y_1,y_2,..,y_n])$$
The calculation becomes increasingly slow as $n$ grows. Do you know any incremental way to update $R^2$ at every new sample, without recalculating it from the beginning every time?