# [math] getCovariance in SingularValueDecomposition

2 messages
Open this post in threaded view
|

## [math] getCovariance in SingularValueDecomposition

 As I understand it (which could easily be wrong), calculation of the covariance (X'X) via SVD follows the following logic: X = USV'    (via SVD, the X' indicates transpose) X'X = (USV')' USV'   this reduces to X'X =  VSU'USV'        = V S S V' In the SingularValueDecomposition class the covariance is calculated as: V × J × VT where J is the diagonal matrix of the inverse of the squares of the singular values I don't understand why the calculation uses the inverse of the singular values. Is that correct? Bruce
Open this post in threaded view
|

## Re: [math] getCovariance in SingularValueDecomposition

 I've figured out what the issue is here.  Basically, there is ambiguity in what is meant by the covariance matrix. The getCovariance method in the SingularValueDecomposition class returns a covariance matrix that could be used to describe the covariance between the best-fit  parameters obtained by using the SVD to do a least-squares fit.  See, for example, the discussion in the section "Confidence Limits from Singular Value Decomposition" in Numerical Recipes (end of section 14.5 in the edition I have).  The code correctly (as far as I can tell) correctly implements this. I was looking for the covariance matrix as used, for example, in Principle Component Analysis, which is formed from X'X.  The SVD is a useful way to calculate this using the formula (derived in my earlier email) as: V*S^2*V' The documentation describes exactly what is actually calculated and if one pays attention to the that there is no ambiguity.  On the other hand I might not be the only person that sees a method called "getCovariance" and expects that it will give X'X. Bruce On Oct 7, 2014, at 9:59 PM, Bruce A Johnson <[hidden email]> wrote: > As I understand it (which could easily be wrong), calculation of the covariance (X'X) via SVD follows the following logic: > > X = USV'    (via SVD, the X' indicates transpose) > > X'X = (USV')' USV'   > > this reduces to > > X'X =  VSU'USV' >       = V S S V' > > In the SingularValueDecomposition class the covariance is calculated as: > > V × J × VT where J is the diagonal matrix of the inverse of the squares of the singular values > > I don't understand why the calculation uses the inverse of the singular values. > > Is that correct? > > Bruce > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email]