The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
Following the notation we have without weights, Bell and McCaffrey (2002) and Pustejovsky and Tipton (2018) suggest
v=sC⊤(X⊤WX)−1∑iX⊤iWiAiϵiϵ⊤iAiWiXi(X⊤WX)−1C
where Ai takes Ii, (Ii−Hii)−12, or (Ii−Hii)−1 is unchanged, but H is changed
H=X(X⊤WX)−1X⊤W
For the degrees of freedom, we have
Gij=g⊤iΦgj
where
gi=s12(I−H)⊤iAiWiXi(X⊤X)−1C
Comparing the previous section with our implementation, we can find
out the differences. Since they have nearly the same symbols, to
differentiate the different part, we use subscript 1 to denote the implementation suggested
by Bell and McCaffrey (2002) and Pustejovsky and Tipton (2018), and use 2 to denote the our implementation of
covariance estimator in mmrm
, we have
v1=sC⊤(X⊤WX)−1∑iX⊤iWiA1,iϵiϵ⊤iA1,iWiXi(X⊤WX)−1C
v2=sC⊤(X⊤WX)−1∑iX⊤iLiA2,iL⊤iϵiϵ⊤iLiA2,iL⊤iXi(X⊤WX)−1C
Here we will prove that they are identical.
First of all, we assume that all Ai matrix, in any form, are positive-definite. Comparing v1 and v2, we see that the different part is
M1,d,i=WiA1,i and M2,d,i=LiA2,iL⊤i
Substitute H1 and H2 with its expression, we have
M1,d,i=Wi(Ii−Xi(X⊤WX)−1X⊤iWi)d
M2,d,i=Li(Ii−L⊤iXi(X⊤WX)−1X⊤iLi)dL⊤i
Where d takes 0, −1/2 and −1 respectively.
Apparently, if d=0, these two are identical because Wi=LiL⊤i.
When d=−1, we have
M2,−1,i=Li(Ii−L⊤iXi(X⊤WX)−1X⊤iLi)−1L⊤i=(L−1i)−1(Ii−L⊤iXi(X⊤WX)−1X⊤iLi)−1((L⊤i)−1)−1=[((L⊤i)−1)(Ii−L⊤iXi(X⊤WX)−1X⊤iLi)(L−1i)]−1=[(L⊤i)−1L−1i−Xi(X⊤WX)−1X⊤i]−1=(W−1i−Xi(X⊤WX)−1X⊤i)−1
M1,−1,i=Wi(Ii−Xi(X⊤WX)−1X⊤iWi)−1=(W−1i)−1(Ii−Xi(X⊤WX)−1X⊤iWi)−1=[(Ii−Xi(X⊤WX)−1X⊤iWi)((W−1i))]−1=(W−1i−Xi(X⊤WX)−1X⊤i)−1
Obviously, M2,−1,i=M1,−1,i, and use the following notation
M2,−1,i=LiB2,iL⊤i
M1,−1,i=WiB1,i
we have
B1,i=W−1iLiB2,iL⊤i=(L⊤i)−1B2,iL⊤i
When d=−1/2, we have the following
M2,−1/2,i=Li(Ii−L⊤iXi(X⊤WX)−1X⊤iLi)−1/2L⊤i=LiB1/22,iL⊤i
M1,−1/2,i=Wi(Ii−Xi(X⊤WX)−1X⊤iWi)−1/2=WiB1/21,i
Apparently if B1/21,i≠(L⊤i)−1B1/22,iL⊤i, we should also have B1/21,iB1/21,i≠(L⊤i)−1B1/22,iL⊤i(L⊤i)−1B1/22,iL⊤i
leading to
B1,i≠(L⊤i)−1B2,iL⊤i
which is contradictory with our previous result. Thus, these covariance estimator are identical.
To prove G1,ij=g⊤1,iΦg1,j and G2,ij=g⊤2,ig2,j are identical, we only need to prove that
L−1g1,i=gmmrmi
where Φ=W−1 according to our previous expression.
We first expand L−1g1,i and gmmrmi
L−1g1,i=L−1(I−X(X⊤WX)−1X⊤W)S⊤iAd1,iWiXi(X⊤WX)−1C
g2,i=(I−L⊤iX(X⊤WX)−1X⊤Li)S⊤iAd2,iL⊤iXi(X⊤WX)−1C
where Si is the row selection matrix.
We will prove the inner part equal L−1(I−X(X⊤WX)−1X⊤W)S⊤iAd1,iWi=(I−L⊤X(X⊤WX)−1X⊤L)S⊤iAd2,iL⊤i
With the previous proof of covariance estimators, we already have
M1,d,i=WiAd1,i=LiAd2,iL⊤i=M2,d,i we then need to prove L−1(I−X(X⊤WX)−1X⊤W)S⊤i=(I−L⊤X(X⊤WX)−1X⊤L)S⊤iL−1i
and note the relationship between (I−X(X⊤WX)−1X⊤W) and (I−L⊤X(X⊤WX)−1X⊤L) has already been proved in covariance estimator section, we only need to prove
L−1(I−X(X⊤WX)−1X⊤W)S⊤i=(I−L⊤X(X⊤WX)−1X⊤L)S⊤iL−1i
Apparently
L−1(I−X(X⊤WX)−1X⊤W)S⊤i=L−1S⊤i−L−1X(X⊤WX)−1X⊤iWi
(I−L⊤X(X⊤WX)−1X⊤L)S⊤iL−1i=S⊤iL−1i−L⊤X(X⊤WX)−1X⊤i
And obviously L−1S⊤i=S⊤iL−1i
L−1X(X⊤WX)−1XiWi=L⊤X(X⊤WX)−1X⊤i
because of the following (X(X⊤WX)−1XiWi)i=Xi(X⊤WX)−1XiWi=WiXi(X⊤WX)−1X⊤i=(WX(X⊤WX)−1X⊤i)i
Empirical covariance matrix is involved with the inverse of a matrix, or symmetric square root of a matrix. To calculate this, we usually requires that the matrix is positive-definite. However, Young (2016) suggest that this is not always assured in practice.
Thus, following Pustejovsky and Tipton
(2018), we use the pseudo inverse to avoid this. We follow the
following logic (see the corresponding C++
function
pseudoInverseSqrt
) to obtain the pseudo inverse:
cpow
to obtain the square root of the reciprocals
of singular values, if the value is larger than a computational
threshold; otherwise replace the value with 0.In Eigen
package, the pseudo inverse method is already
implemented in Eigen::CompleteOrthogonalDecomposition< MatrixType_ >::pseudoInverse
,
but it is not used for the following reason:
NAN
in calculations.In the implementation of the empirical covariance matrix with the Satterthwaite degrees of freedom calculation, it is important to avoid directly computing the crossproduct of the G matrix (i.e., G⊤G). This is because the G matrix can have a large number of columns, in situations with many subjects and/or many coefficients, leading to significant computational and memory overhead. Instead, the current implementation leverages more efficient matrix operations when needed using the contrast matrix during the Satterthwaite degrees of freedom calculation. This approach ensures that the calculation remains feasible and efficient even for large datasets, without any numerical differences.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.