- Source: Partial correlation
In probability theory and statistics, partial correlation measures the degree of association between two random variables, with the effect of a set of controlling random variables removed. When determining the numerical relationship between two variables of interest, using their correlation coefficient will give misleading results if there is another confounding variable that is numerically related to both variables of interest. This misleading information can be avoided by controlling for the confounding variable, which is done by computing the partial correlation coefficient. This is precisely the motivation for including other right-side variables in a multiple regression; but while multiple regression gives unbiased results for the effect size, it does not give a numerical value of a measure of the strength of the relationship between the two variables of interest.
For example, given economic data on the consumption, income, and wealth of various individuals, consider the relationship between consumption and income. Failing to control for wealth when computing a correlation coefficient between consumption and income would give a misleading result, since income might be numerically related to wealth which in turn might be numerically related to consumption; a measured correlation between consumption and income might actually be contaminated by these other correlations. The use of a partial correlation avoids this problem.
Like the correlation coefficient, the partial correlation coefficient takes on a value in the range from –1 to 1. The value –1 conveys a perfect negative correlation controlling for some variables (that is, an exact linear relationship in which higher values of one variable are associated with lower values of the other); the value 1 conveys a perfect positive linear relationship, and the value 0 conveys that there is no linear relationship.
The partial correlation coincides with the conditional correlation if the random variables are jointly distributed as the multivariate normal, other elliptical, multivariate hypergeometric, multivariate negative hypergeometric, multinomial, or Dirichlet distribution, but not in general otherwise.
Formal definition
Formally, the partial correlation between X and Y given a set of n controlling variables Z = {Z1, Z2, ..., Zn}, written ρXY·Z, is the correlation between the residuals eX and eY resulting from the linear regression of X with Z and of Y with Z, respectively. The first-order partial correlation (i.e., when n = 1) is the difference between a correlation and the product of the removable correlations divided by the product of the coefficients of alienation of the removable correlations. The coefficient of alienation, and its relation with joint variance through correlation are available in Guilford (1973, pp. 344–345).
Computation
= Using linear regression
=A simple way to compute the sample partial correlation for some data is to solve the two associated linear regression problems and calculate the correlation between the residuals. Let X and Y be random variables taking real values, and let Z be the n-dimensional vector-valued random variable. Let xi, yi and zi denote the ith of
N
{\displaystyle N}
i.i.d. observations from some joint probability distribution over real random variables X, Y, and Z, with zi having been augmented with a 1 to allow for a constant term in the regression. Solving the linear regression problem amounts to finding (n+1)-dimensional regression coefficient vectors
w
X
∗
{\displaystyle \mathbf {w} _{X}^{*}}
and
w
Y
∗
{\displaystyle \mathbf {w} _{Y}^{*}}
such that
w
X
∗
=
arg
min
w
{
∑
i
=
1
N
(
x
i
−
⟨
w
,
z
i
⟩
)
2
}
{\displaystyle \mathbf {w} _{X}^{*}=\arg \min _{\mathbf {w} }\left\{\sum _{i=1}^{N}(x_{i}-\langle \mathbf {w} ,\mathbf {z} _{i}\rangle )^{2}\right\}}
w
Y
∗
=
arg
min
w
{
∑
i
=
1
N
(
y
i
−
⟨
w
,
z
i
⟩
)
2
}
{\displaystyle \mathbf {w} _{Y}^{*}=\arg \min _{\mathbf {w} }\left\{\sum _{i=1}^{N}(y_{i}-\langle \mathbf {w} ,\mathbf {z} _{i}\rangle )^{2}\right\}}
where
N
{\displaystyle N}
is the number of observations, and
⟨
w
,
z
i
⟩
{\displaystyle \langle \mathbf {w} ,\mathbf {z} _{i}\rangle }
is the scalar product between the vectors
w
{\displaystyle \mathbf {w} }
and
z
i
{\displaystyle \mathbf {z} _{i}}
.
The residuals are then
e
X
,
i
=
x
i
−
⟨
w
X
∗
,
z
i
⟩
{\displaystyle e_{X,i}=x_{i}-\langle \mathbf {w} _{X}^{*},\mathbf {z} _{i}\rangle }
e
Y
,
i
=
y
i
−
⟨
w
Y
∗
,
z
i
⟩
{\displaystyle e_{Y,i}=y_{i}-\langle \mathbf {w} _{Y}^{*},\mathbf {z} _{i}\rangle }
and the sample partial correlation is then given by the usual formula for sample correlation, but between these new derived values:
ρ
^
X
Y
⋅
Z
=
N
∑
i
=
1
N
e
X
,
i
e
Y
,
i
−
∑
i
=
1
N
e
X
,
i
∑
i
=
1
N
e
Y
,
i
N
∑
i
=
1
N
e
X
,
i
2
−
(
∑
i
=
1
N
e
X
,
i
)
2
N
∑
i
=
1
N
e
Y
,
i
2
−
(
∑
i
=
1
N
e
Y
,
i
)
2
=
N
∑
i
=
1
N
e
X
,
i
e
Y
,
i
N
∑
i
=
1
N
e
X
,
i
2
N
∑
i
=
1
N
e
Y
,
i
2
.
{\displaystyle {\begin{aligned}{\hat {\rho }}_{XY\cdot \mathbf {Z} }&={\frac {N\sum _{i=1}^{N}e_{X,i}e_{Y,i}-\sum _{i=1}^{N}e_{X,i}\sum _{i=1}^{N}e_{Y,i}}{{\sqrt {N\sum _{i=1}^{N}e_{X,i}^{2}-\left(\sum _{i=1}^{N}e_{X,i}\right)^{2}}}~{\sqrt {N\sum _{i=1}^{N}e_{Y,i}^{2}-\left(\sum _{i=1}^{N}e_{Y,i}\right)^{2}}}}}\\&={\frac {N\sum _{i=1}^{N}e_{X,i}e_{Y,i}}{{\sqrt {N\sum _{i=1}^{N}e_{X,i}^{2}}}~{\sqrt {N\sum _{i=1}^{N}e_{Y,i}^{2}}}}}.\end{aligned}}}
In the first expression the three terms after minus signs all equal 0 since each contains the sum of residuals from an ordinary least squares regression.
Example
Consider the following data on three variables, X, Y, and Z:
Computing the Pearson correlation coefficient between variables X and Y results in approximately 0.970, while computing the partial correlation between X and Y, using the formula given above, gives a partial correlation of 0.919. The computations were done using R with the following code.
The lower part of the above code reports generalized nonlinear partial correlation coefficient between X and Y after removing the nonlinear effect of Z to be 0.8844. Also, the generalized nonlinear partial correlation coefficient between X and Z after removing the nonlinear effect of Y to be 0.1581. See the R package `generalCorr' and its vignettes for details. Simulation and other details are in Vinod (2017) "Generalized correlation and kernel causality with applications in development economics," Communications in Statistics - Simulation and Computation, vol. 46, [4513, 4534], available online: 29 Dec 2015, URL https://doi.org/10.1080/03610918.2015.1122048.
= Using recursive formula
=It can be computationally expensive to solve the linear regression problems. Actually, the nth-order partial correlation (i.e., with |Z| = n) can be easily computed from three (n - 1)th-order partial correlations. The zeroth-order partial correlation ρXY·Ø is defined to be the regular correlation coefficient ρXY.
It holds, for any
Z
0
∈
Z
,
{\displaystyle Z_{0}\in \mathbf {Z} ,}
that
ρ
X
Y
⋅
Z
=
ρ
X
Y
⋅
Z
∖
{
Z
0
}
−
ρ
X
Z
0
⋅
Z
∖
{
Z
0
}
ρ
Z
0
Y
⋅
Z
∖
{
Z
0
}
1
−
ρ
X
Z
0
⋅
Z
∖
{
Z
0
}
2
1
−
ρ
Z
0
Y
⋅
Z
∖
{
Z
0
}
2
{\displaystyle \rho _{XY\cdot \mathbf {Z} }={\frac {\rho _{XY\cdot \mathbf {Z} \setminus \{Z_{0}\}}-\rho _{XZ_{0}\cdot \mathbf {Z} \setminus \{Z_{0}\}}\rho _{Z_{0}Y\cdot \mathbf {Z} \setminus \{Z_{0}\}}}{{\sqrt {1-\rho _{XZ_{0}\cdot \mathbf {Z} \setminus \{Z_{0}\}}^{2}}}{\sqrt {1-\rho _{Z_{0}Y\cdot \mathbf {Z} \setminus \{Z_{0}\}}^{2}}}}}}
Naïvely implementing this computation as a recursive algorithm yields an exponential time complexity. However, this computation has the overlapping subproblems property, such that using dynamic programming or simply caching the results of the recursive calls yields a complexity of
O
(
n
3
)
{\displaystyle {\mathcal {O}}(n^{3})}
.
Note in the case where Z is a single variable, this reduces to:
ρ
X
Y
⋅
Z
=
ρ
X
Y
−
ρ
X
Z
ρ
Z
Y
1
−
ρ
X
Z
2
1
−
ρ
Z
Y
2
{\displaystyle \rho _{XY\cdot Z}={\frac {\rho _{XY}-\rho _{XZ}\rho _{ZY}}{{\sqrt {1-\rho _{XZ}^{2}}}{\sqrt {1-\rho _{ZY}^{2}}}}}}
= Using matrix inversion
=The partial correlation can also be written in terms of the joint precision matrix. Consider a set of random variables,
V
=
X
1
,
…
,
X
n
{\displaystyle \mathbf {V} ={X_{1},\dots ,X_{n}}}
of cardinality n. We want the partial correlation between two variables
X
i
{\displaystyle X_{i}}
and
X
j
{\displaystyle X_{j}}
given all others, i.e.,
V
∖
{
X
i
,
X
j
}
{\displaystyle \mathbf {V} \setminus \{X_{i},X_{j}\}}
. Suppose the (joint/full) covariance matrix
Σ
=
(
σ
i
j
)
{\displaystyle \Sigma =(\sigma _{ij})}
is positive definite and therefore invertible. If the precision matrix is defined as
Ω
=
(
p
i
j
)
=
Σ
−
1
{\displaystyle \Omega =(p_{ij})=\Sigma ^{-1}}
, then
Computing this requires
Σ
−
1
{\displaystyle \Sigma ^{-1}}
, the inverse of the covariance matrix
Σ
{\displaystyle \Sigma }
which runs in
O
(
n
3
)
{\displaystyle {\mathcal {O}}(n^{3})}
time (using the sample covariance matrix to obtain a sample partial correlation). Note that only a single matrix inversion is required to give all the partial correlations between pairs of variables in
V
{\displaystyle \mathbf {V} }
.
To prove Equation (1), return to the previous notation (i.e.
X
,
Y
,
Z
↔
X
i
,
X
j
,
V
∖
{
X
i
,
X
j
}
{\displaystyle X,Y,\mathbf {Z} \leftrightarrow X_{i},X_{j},\mathbf {V} \setminus \{X_{i},X_{j}\}}
) and start with the definition of partial correlation: ρXY·Z is the correlation between the residuals eX and eY resulting from the linear regression of X with Z and of Y with Z, respectively.
First, suppose
β
,
γ
{\displaystyle \beta ,\gamma }
are the coefficients for linear regression fit; that is,
β
=
argmin
β
E
‖
X
−
β
T
Z
‖
2
{\displaystyle \beta =\operatorname {argmin} _{\beta }\mathbb {E} \|X-\beta ^{T}Z\|^{2}}
γ
=
argmin
γ
E
‖
Y
−
γ
T
Z
‖
2
{\displaystyle \gamma =\operatorname {argmin} _{\gamma }\mathbb {E} \|Y-\gamma ^{T}Z\|^{2}}
Write the joint covariance matrix for the vector
(
X
,
Y
,
Z
T
)
T
{\displaystyle (X,Y,Z^{T})^{T}}
as
Σ
=
[
Σ
X
X
Σ
X
Y
Σ
X
Z
Σ
Y
X
Σ
Y
Y
Σ
Y
Z
Σ
Z
X
Σ
Z
Y
Σ
Z
Z
]
=
[
C
11
C
12
C
21
C
22
]
{\displaystyle \Sigma ={\begin{bmatrix}\Sigma _{XX}&\Sigma _{XY}&\Sigma _{XZ}\\\Sigma _{YX}&\Sigma _{YY}&\Sigma _{YZ}\\\Sigma _{ZX}&\Sigma _{ZY}&\Sigma _{ZZ}\end{bmatrix}}={\begin{bmatrix}C_{11}&C_{12}\\C_{21}&C_{22}\\\end{bmatrix}}}
where
C
11
=
[
Σ
X
X
Σ
X
Y
Σ
Y
X
Σ
Y
Y
]
,
C
12
=
[
Σ
X
Z
Σ
Y
Z
]
,
C
21
=
[
Σ
Z
X
Σ
Z
Y
]
,
C
22
=
Σ
Z
Z
{\displaystyle C_{11}={\begin{bmatrix}\Sigma _{XX}&\Sigma _{XY}\\\Sigma _{YX}&\Sigma _{YY}\end{bmatrix}},\qquad C_{12}={\begin{bmatrix}\Sigma _{XZ}\\\Sigma _{YZ}\end{bmatrix}},\qquad C_{21}={\begin{bmatrix}\Sigma _{ZX}&\Sigma _{ZY}\end{bmatrix}},\qquad C_{22}=\Sigma _{ZZ}}
Then the standard formula for linear regression gives
β
=
(
Σ
Z
Z
)
−
1
Σ
Z
X
{\displaystyle \beta =\left(\Sigma _{ZZ}\right)^{-1}\Sigma _{ZX}}
Hence, the residuals can be written as
R
X
=
X
−
β
T
Z
=
X
−
Σ
X
Z
(
Σ
Z
Z
)
−
1
Z
{\displaystyle R_{X}=X-\beta ^{T}Z=X-\Sigma _{XZ}\left(\Sigma _{ZZ}\right)^{-1}Z}
Note that
R
X
{\displaystyle R_{X}}
has expectation zero because of the inclusion of an intercept term in
Z
{\displaystyle Z}
. Computing the covariance now gives
Next, write the precision matrix
Ω
=
Σ
−
1
{\displaystyle \Omega =\Sigma ^{-1}}
in a similar block form:
Ω
=
[
Ω
X
X
Ω
X
Y
Ω
X
Z
Ω
Y
X
Ω
Y
Y
Ω
Y
Z
Ω
Z
X
Ω
Z
Y
Ω
Z
Z
]
=
[
P
11
P
12
P
21
P
22
]
{\displaystyle \Omega ={\begin{bmatrix}\Omega _{XX}&\Omega _{XY}&\Omega _{XZ}\\\Omega _{YX}&\Omega _{YY}&\Omega _{YZ}\\\Omega _{ZX}&\Omega _{ZY}&\Omega _{ZZ}\end{bmatrix}}={\begin{bmatrix}P_{11}&P_{12}\\P_{21}&P_{22}\\\end{bmatrix}}}
Then, by Schur's formula for block-matrix inversion,
P
11
−
1
=
C
11
−
C
12
C
22
−
1
C
21
{\displaystyle P_{11}^{-1}=C_{11}-C_{12}C_{22}^{-1}C_{21}}
The entries of the right-hand-side matrix are precisely the covariances previously computed in (2), giving
P
11
−
1
=
[
Cov
(
R
X
,
R
X
)
Cov
(
R
X
,
R
Y
)
Cov
(
R
Y
,
R
X
)
Cov
(
R
Y
,
R
Y
)
]
{\displaystyle P_{11}^{-1}={\begin{bmatrix}\operatorname {Cov} (R_{X},R_{X})&\operatorname {Cov} (R_{X},R_{Y})\\\operatorname {Cov} (R_{Y},R_{X})&\operatorname {Cov} (R_{Y},R_{Y})\\\end{bmatrix}}}
Using the formula for the inverse of a 2×2 matrix gives
P
11
−
1
=
1
det
P
11
(
[
P
11
]
22
−
[
P
11
]
12
−
[
P
11
]
21
[
P
11
]
11
)
=
1
det
P
11
(
p
Y
Y
−
p
X
Y
−
p
Y
X
p
X
X
)
{\displaystyle {\begin{aligned}P_{11}^{-1}&={\frac {1}{{\text{det}}P_{11}}}{\begin{pmatrix}[P_{11}]_{22}&-[P_{11}]_{12}\\-[P_{11}]_{21}&[P_{11}]_{11}\\\end{pmatrix}}\\&={\frac {1}{{\text{det}}P_{11}}}{\begin{pmatrix}p_{YY}&-p_{XY}\\-p_{YX}&p_{XX}\\\end{pmatrix}}\end{aligned}}}
So indeed, the partial correlation is
ρ
X
Y
⋅
Z
=
Cov
(
R
X
,
R
Y
)
Cov
(
R
X
,
R
X
)
Cov
(
R
Y
,
R
Y
)
=
−
1
det
P
11
p
X
Y
1
det
P
11
p
X
X
1
det
P
11
p
Y
Y
=
−
p
X
Y
p
X
X
p
Y
Y
{\displaystyle \rho _{XY\cdot Z}={\frac {\operatorname {Cov} (R_{X},R_{Y})}{\sqrt {\operatorname {Cov} (R_{X},R_{X})\operatorname {Cov} (R_{Y},R_{Y})}}}={\frac {-{\tfrac {1}{{\text{det}}P_{11}}}p_{XY}}{\sqrt {{\tfrac {1}{{\text{det}}P_{11}}}p_{XX}{\tfrac {1}{{\text{det}}P_{11}}}p_{YY}}}}=-{\frac {p_{XY}}{\sqrt {p_{XX}p_{YY}}}}}
as claimed in (1).
Interpretation
= Geometrical
=Let three variables X, Y, Z (where Z is the "control" or "extra variable") be chosen from a joint probability distribution over n variables V. Further, let vi, 1 ≤ i ≤ N, be N n-dimensional i.i.d. observations taken from the joint probability distribution over V. The geometrical interpretation comes from considering the N-dimensional vectors x (formed by the successive values of X over the observations), y (formed by the values of Y), and z (formed by the values of Z).
It can be shown that the residuals eX,i coming from the linear regression of X on Z, if also considered as an N-dimensional vector eX (denoted rX in the accompanying graph), have a zero scalar product with the vector z generated by Z. This means that the residuals vector lies on an (N–1)-dimensional hyperplane Sz that is perpendicular to z.
The same also applies to the residuals eY,i generating a vector eY. The desired partial correlation is then the cosine of the angle φ between the projections eX and eY of x and y, respectively, onto the hyperplane perpendicular to z.: ch. 7
= As conditional independence test
=With the assumption that all involved variables are multivariate Gaussian, the partial correlation ρXY·Z is zero if and only if X is conditionally independent from Y given Z. This property does not hold in the general case.
To test if a sample partial correlation
ρ
^
X
Y
⋅
Z
{\displaystyle {\hat {\rho }}_{XY\cdot \mathbf {Z} }}
implies that the true population partial correlation differs from 0, Fisher's z-transform of the partial correlation can be used:
z
(
ρ
^
X
Y
⋅
Z
)
=
1
2
ln
(
1
+
ρ
^
X
Y
⋅
Z
1
−
ρ
^
X
Y
⋅
Z
)
{\displaystyle z({\hat {\rho }}_{XY\cdot \mathbf {Z} })={\frac {1}{2}}\ln \left({\frac {1+{\hat {\rho }}_{XY\cdot \mathbf {Z} }}{1-{\hat {\rho }}_{XY\cdot \mathbf {Z} }}}\right)}
The null hypothesis is
H
0
:
ρ
X
Y
⋅
Z
=
0
{\displaystyle H_{0}:\rho _{XY\cdot \mathbf {Z} }=0}
, to be tested against the two-tail alternative
H
A
:
ρ
X
Y
⋅
Z
≠
0
{\displaystyle H_{A}:\rho _{XY\cdot \mathbf {Z} }\neq 0}
.
H
0
{\displaystyle H_{0}}
can be rejected if
N
−
|
Z
|
−
3
⋅
|
z
(
ρ
^
X
Y
⋅
Z
)
|
>
Φ
−
1
(
1
−
α
/
2
)
{\displaystyle {\sqrt {N-|\mathbf {Z} |-3}}\cdot |z({\hat {\rho }}_{XY\cdot \mathbf {Z} })|>\Phi ^{-1}(1-\alpha /2)}
where
Φ
{\displaystyle \Phi }
is the cumulative distribution function of a Gaussian distribution with zero mean and unit standard deviation,
α
{\displaystyle \alpha }
is the significance level of
H
0
{\displaystyle H_{0}}
, and
N
{\displaystyle N}
is the sample size. This z-transform is approximate, and the actual distribution of the sample (partial) correlation coefficient is not straightforward. However, an exact t-test based on a combination of the partial regression coefficient, the partial correlation coefficient, and the partial variances is available.
The distribution of the sample partial correlation was described by Fisher.
Semipartial correlation (part correlation)
The semipartial (or part) correlation statistic is similar to the partial correlation statistic; both compare variations of two variables after certain factors are controlled for. However, to calculate the semipartial correlation, one holds the third variable constant for either X or Y but not both; whereas for the partial correlation, one holds the third variable constant for both. The semipartial correlation compares the unique variation of one variable (having removed variation associated with the Z variable(s)) with the unfiltered variation of the other, while the partial correlation compares the unique variation of one variable to the unique variation of the other.
The semipartial correlation can be viewed as more practically relevant "because it is scaled to (i.e., relative to) the total variability in the dependent (response) variable." Conversely, it is less theoretically useful because it is less precise about the role of the unique contribution of the independent variable.
The absolute value of the semipartial correlation of X with Y is always less than or equal to that of the partial correlation of X with Y. The reason is this: Suppose the correlation of X with Z has been removed from X, giving the residual vector ex . In computing the semipartial correlation, Y still contains both unique variance and variance due to its association with Z. But ex , being uncorrelated with Z, can only explain some of the unique part of the variance of Y and not the part related to Z. In contrast, with the partial correlation, only ey (the part of the variance of Y that is unrelated to Z) is to be explained, so there is less variance of the type that ex cannot explain.
Use in time series analysis
In time series analysis, the partial autocorrelation function (sometimes "partial correlation function") of a time series is defined, for lag
h
{\displaystyle h}
, as
φ
(
h
)
=
ρ
X
0
X
h
⋅
{
X
1
,
…
,
X
h
−
1
}
{\displaystyle \varphi (h)=\rho _{X_{0}X_{h}\,\cdot \,\{X_{1},\,\dots \,,X_{h-1}\}}}
This function is used to determine the appropriate lag length for an autoregression.
See also
Linear regression
Conditional independence
Multiple correlation
Partial information decomposition
References
External links
Prokhorov, A.V. (2001) [1994], "Partial correlation coefficient", Encyclopedia of Mathematics, EMS Press
Mathematical formulae in the "Description" section of the IMSL Numerical Library PCORR routine
A three-variable example
Kata Kunci Pencarian:
- Statistika
- Ilmu aktuaria
- Statistika matematika
- Variabel acak
- Efek pengacau
- Model generatif
- Eksperimen semu
- Modulus geser
- Transformasi Laplace
- Nitrazepam
- Partial correlation
- Pearson correlation coefficient
- Autocorrelation
- Correlation coefficient
- Spearman's rank correlation coefficient
- Correlation
- Cross-correlation
- Principal component analysis
- Partial autocorrelation function
- Kaiser–Meyer–Olkin test