Below is a sketch of two complementary strategies that avoid “from-scratch” (O(k^3)) inversions every time you change your conditioning set of size (k). In both cases you only pay roughly (O(k^2)) per add/remove of one variable.
- Rank-one (Sherman–Morrison–Woodbury) updates of the inverse
Suppose at some point you have
• a set (A) of (k) variables,
• the (k\times k) submatrix (\Sigma_{AA}),
• and its inverse (M = \Sigma_{AA}^{-1}).
Now you want to test (;X\perp Y\mid A\cup{z}), i.e.\ you enlarge the set (A) by one new variable (z). Call the new index set (A' = A\cup{z}). Write the enlarged covariance block as
[
\Sigma_{A'A'} ;=;
\begin{pmatrix}
\Sigma_{AA} & \Sigma_{A,z}\[6pt]
\Sigma_{z,A} & \Sigma_{zz}
\end{pmatrix}.
]
Set
[
u ;=;\Sigma_{A,z}\quad(\text{a (k)-vector}),\qquad
\alpha;=;\Sigma_{zz}\quad(\text{a scalar}),\qquad
M;=;\Sigma_{AA}^{-1}.
]
Then the Schur-block‐inverse formula (special case of SMW) says
[
s ;=;\alpha;-;u^{T},M,u,
]
and
[
\Sigma_{A'A'}^{-1}
\begin{pmatrix}
M + \frac{M,u,u^{T}M}{,s,}
& -,\frac{M,u}{,s,}\[8pt]
-,\frac{u^{T}M}{,s,}
& \phantom{+}\frac1{s,}
\end{pmatrix}.
]
Notice:
• Computing (u^{T}M,u) costs (O(k^2)).
• Forming the four blocks of the new inverse also costs (O(k^2)).
Thus every time you add one conditioning variable, you “grow” your old inverse in (O(k^2)) instead of (O((k+1)^3)).
Similarly, if you need to remove a variable from your set, there is a corresponding downdate (via another Schur complement) that again costs (O(k^2)).
In most constraint‐based causal searches you do build up conditioning sets one variable at a time, so you get to reuse the previous (\Sigma_{AA}^{-1}) at each step.
- Regression/QR / Cholesky downdates of partial correlations
Recall you can compute the partial correlation
[
\rho_{X,Y\mid A}
= \mathrm{corr}\bigl(\mathrm{resid}(X\sim A),;\mathrm{resid}(Y\sim A)\bigr).
]
If you perform a QR (or Cholesky/LDL(^T)) factorization of the full design-matrix for (A), you can cheaply (in (O(k^2))) add or remove columns via Givens‐rotations or rank-one updates/downdates to the (R) (or (L)) factor. Once you have the updated factorization
• Solving for the residuals of (X) on (A) or (Y) on (A) is just two back-substitutions ((O(k^2))).
• Finally you compute a simple Pearson correlation of the two residual vectors ((O(n))).
This is often numerically more stable than fiddling with low‐rank corrections to the covariance inverse, and it ties in nicely if you already have a big data matrix (n\times p).
Putting it all together
- Precompute the full (p\times p) correlation matrix (\Sigma).
- When you start testing ((X,Y\mid Z)) for (|Z|=k), either
a. Use the SMW/block-inverse approach to build (\Sigma_{AA}^{-1}) in (k) small “grow” steps from a smaller set, or
b. Build a QR/Cholesky factor of the columns in (A) by successive add/downdates.
- Extract the needed partial correlation (\rho_{XY\mid A}) in (O(k^2)) rather than (O(k^3)).
- Repeat for different ((X,Y\mid Z)), reusing / updating your previous factor or inverse whenever (Z) differs by only one variable.
Between these two strategies you can often turn a cubic-per-test routine into a quadratic-per-test one—an enormous gain when the PC/FCI algorithm is running thousands or millions of Fisher-(Z) tests.
Good references for the block-inverse formulas and rank-one updates/downdates are
• Harville, “Matrix Algebra From a Statistician’s Perspective” (Ch. 18),
• Golub & Van Loan, “Matrix Computations” (Sec. 3.3, Sec. 12.4).
And for QR/Givens‐based update/downdate see
• Björck, “Numerical Methods for Least Squares Problems” (Ch. 9).