Skip to content

Commit 418a4bd

Browse files
committed
Update proof for least squares
1 parent bd868a9 commit 418a4bd

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

src/bin/least_squares.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,12 @@ fn main() {
9999
println!("Estimated beta coefficeints from pseudoinverse:\n{:?}", b);
100100
// Having the pseudoinverse, we can now compute t-values as well.
101101
// Recall the variance-covariance matrix of the estimates of b is given by
102-
// inv(x'*x). Recall also that pinv(x) = inv(x'*x)*x'. The pseudoinverse
103-
// has the property that A * pinv(A) = I and also that pinv(A)' = pinv(A').
104-
// Therefore we can write the following to get the variance-covariance
105-
// matrix from the pseudoinverse:
106-
// pinv(x)*pinv(x') = inv(x'*x)*x'*pinv(x')
107-
// pinv(x)*pinv(x') = inv(x'*x)*I
108-
// pinv(x)*pinv(x') = inv(x'*x)
109-
// pinv(x)*pinv(x)' = inv(x'*x)
102+
// inv(x'*x). Since the inverse of x'*x is guaranteed to exist, it is true
103+
// that inv(x'*x) = pinv(x'*x). Then, using Greville's proof:
104+
// inv(x'*x) = pinv(x'*x) = pinv(x)*pinv(x') = pinv(x)*pinv(x)'
105+
// https://epubs.siam.org/doi/10.1137/1008107
106+
// The last step is true because the pseudoinverse operation commutes with
107+
// the complex conjugate (transpose).
110108
//
111109
// (Note also that we can compute the variance-covariance matrix directly
112110
// from the singular value decomposition as v*inv(s).^2*v')

0 commit comments

Comments
 (0)