[R] chol2inv question
Ross Ihaka
ihaka at stat.auckland.ac.nz
Tue Mar 21 20:58:53 CET 2000
On Tue, Mar 21, 2000 at 08:32:35PM +0800, cwu wrote:
> Hi there,
>
> Please help me this out.
>
> > m
> [,1] [,2]
> [1,] 1.1 1.0
> [2,] 1.0 1.1
> > chol2inv(m)
> [,1] [,2]
> [1,] 1.5094597 -0.7513148
> [2,] -0.7513148 0.8264463
chol2inv wants the choleski decompostion of m as its argument.
> m
[,1] [,2]
[1,] 1.1 1.0
[2,] 1.0 1.1
> mc <- chol(m)
> chol2inv(mc)
[,1] [,2]
[1,] 5.238095 -4.761905
[2,] -4.761905 5.238095
Compare this with the inverse computed directly by Householder
transformations.
> solve(m)
[,1] [,2]
[1,] 5.238095 -4.761905
[2,] -4.761905 5.238095
Hope this helps.
Ross
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list