[R] R Matrix package solve
Matt Nunes
Matt.Nunes at bristol.ac.uk
Wed Aug 4 12:31:31 CEST 2004
hello.
I have a query about the Matrix package for R. I wrote some code a while
ago using the Matrix package version 1.6.2 with an early version of R, to
do some linear least squares for regression:
xn
[,1] [,2] [,3] [,4]
[1,] 1 0.7429352 0.5519528 0.4100652
[2,] 1 0.7443713 0.5540886 0.4124477
[3,] 1 0.7447385 0.5546355 0.4130584
[4,] 1 0.7459597 0.5564558 0.4150936
>
> temp<-crossprod(xn)
> temp
[,1] [,2] [,3] [,4]
[1,] 4.000000 2.978005 2.2171327 1.6506648
[2,] 2.978005 2.217133 1.6506648 1.2289297
[3,] 2.217133 1.650665 1.2289297 0.9149473
[4,] 1.650665 1.228930 0.9149473 0.6811865
>
> solve.Matrix(temp,t(xn))
[,1] [,2] [,3] [,4]
[1,] 33397.34 122081.7 -241005.4 85527.48
[2,] 21063.72 -664920.2 812316.0 -168459.99
[3,] -236935.74 1125548.2 -877776.2 -10835.64
[4,] 199314.69 -608045.8 297509.1 111221.72
(Note: here I used solve.Matrix since the generic solve said the matrix is
singular).
I recently updated my versions of R to 1.9.1 and also the Matrix package,
but I can't seem to get any similar equivalent matrix calculations to work
(I get error messages like ".Call function name not in DLL for package
Matrix" or "Lapack routine dpotrf returned error code 4"). I have also
tried using symmetric matrix commands, but to no avail. Can anyone help me
out?
many thanks
Matt Nunes
------------------------
Matt Nunes
School of Mathematics, University of Bristol,
University Walk, Bristol. BS8 1TW. UK.
office tel. 0117 3311662 (room 1.1 St. Michael's House)
Matt.Nunes at bristol.ac.uk
http://www.maths.bris.ac.uk/~maman/
More information about the R-help
mailing list