For the linear model $y = X\beta$ for design matrix $X$, it's well known that the optimal solution is $\hat{\beta} = (X'X)^{-1}X'y$.
Some statistical libraries (such as Python's statsmodels) estimate parameters by first computing the pseudoinverse of the design matrix: $X^{+} = \text{pseudoinverse}(X) = (X'X)^{-1}X'$ and then computing the estimate as $\hat{\beta}=X^{+}y$.
I'm operating in a restricted memory environment with a "tall and skinny" design matrix with shapes up to (1e8,3). Computing the pseudoinverse requires allocating an additional matrix X^{+} of shape (3,1e8) before computing the final parameters and it is at this step that I often run out of memory.
We can contrast that with computing the parameters in 3 steps:
- $A = (X'X)^{-1}$. This allocates a 3x3 matrix then inverts it.
- $B = X'y$. This allocates a 3x1 vector.
- $\hat{\beta} = AB$.
My question is: are there any downsides (such as numerical issues) to computing the OLS estimates using the methodology above? I can guarantee the absence of perfect multicollinearity (from the structure of the design matrix) thus guaranteeing that the inverse of the gram matrix ($A$) exists.