# How to do multiple linear regressions with overlapping predictors efficiently

I'm using covariance matrices to do a linear regression. I have the same number of predictors and dependent variables (3000 of each). For each $$i$$, $$X_{i}$$ and $$Y_{i}$$ have a kind of symmetry.

I gather covariance matrices of these variables ($$X'X$$ and $$X'Y$$). I want to do a regression where for each dependent variable, the features are the first 1,000 dependent variables plus its own dependent variable.

For example, to predict $$Y_{2000}$$ I want to use $$X_{1},...,X_{1000}$$ plus $$X_{2000}$$, etc. I could do this by inverting 3000 different matrices. But that is computationally expensive. Is there a way to do this more efficiently by overlapping the computation?

• You’re using $Y_i$ as a predictor of $Y_i$?
– Dave
Commented Apr 18, 2020 at 16:18
• I'm using X.1 .. X1000 PLUS Xi as a predictor of Yi. I actually just figured out the answer to my question. It's here en.wikipedia.org/wiki/Sherman%E2%80%93Morrison_formula Commented Apr 18, 2020 at 23:20