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

Jerome Asselin jerome at hivnet.ubc.ca
Fri Jul 11 18:24:34 CEST 2003


If some of the eigenvalues of a square matrix are (close to) zero, then 
it's inverse does not exist. However, you can always calculate it's 
generalized inverse ginv().

library(MASS)
help(ginv)

It'll allow you to specify a "tol" argument:
     tol: A relative tolerance to detect zero singular values.

Hope that helps,
Jerome

On July 11, 2003 08:49 am, ge yreyt wrote:
> Content-Length: 2154
> Status: R
> X-Status: N
>
> 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>

>
> Since the inverse matrix = u * inverse(d) * v',
> If I calculate inverse d based on formula : 1/d, then
> 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???
>
>
> Thanks
>
> ping
>
>
> ______________________________________________________________________
> Post your free ad now! http://personals.yahoo.ca
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help




More information about the R-help mailing list