[R] using SVD to get an inverse matrix of covariance matrix

Thomas Lumley tlumley at u.washington.edu
Fri Jul 11 18:16:36 CEST 2003


On Fri, 11 Jul 2003, ge yreyt wrote:

> Dear R-users,
>
> I have one question about using SVD to get an inverse
> matrix of covariance matrix
>
> Sometimes I met many singular values d are close to 0:
> look this example

<snip>

> most values of inverse matrix
> will be huge. This must be not a good way. MOre
> special case, if a single value is 0, then
> we can not calculate inverse d based on 1/d.
>
> Therefore, my question is how I can calculate inverse
> d (that is inverse diag(d) more efficiently???
>

If singular values are zero the matrix doesn't have an inverse: that is,
the equation   Mx=b  will have multiple solutions for any given b.

It is possible to get a pseudoinverse, a matrix M that picks out one of
the solutions.  One way to do this is to set the diagonal to 1/d where d
is not (nearly) zero and to 0 when d is (nearly) zero. One place to find a
discussion of this is `Matrix Computations' by Golub and van Loan.


	-thomas




More information about the R-help mailing list