I suspect your "matrix" X may really be a datasheet or something that
doesn't really have exact matrix attributes. The same thing happen to me
when I imported your data as a datasheet. This worked:
solve(as.matrix(X))
- Lane
-----Original Message-----
From: Agin.Patrick@hydro.qc.ca [mailto:Agin.Patrick@hydro.qc.ca]
Sent: Friday, September 29, 2000 11:59 AM
To: s-news@wubios.wustl.edu
Subject: [S] rank of a matrix with SVD is good?
Hi everyone,
Is the Singular Value Decomposition a good way to calculate the rank
of a square matrix?
I have the following problem: my matrix X (10x10) seems to be
singular and thus not invertible. Yet, I count the number of positive
singular values (greater say than a *tolerance* small number) and the result
is 10.
For interested readers, my matrix X is:
2.30 0.19 -1.62 -1.04 1.39 -1.07 -2.19 3.00 -0.94 0.24
0.23 -1.03 -0.58 -0.36 0.18 -1.87 -1.72 0.50 -0.94 1.36
2.47 -0.64 1.88 -0.33 0.71 -1.34 -0.38 1.41 0.43 -0.72
-0.78 2.77 -0.23 1.38 -1.09 -2.93 -1.66 -0.64 2.86 -0.72
0.42 1.56 0.24 1.73 0.92 -1.10 -0.30 -0.54 1.51 -0.72
-0.10 -0.54 1.01 -1.81 0.28 -1.06 0.10 0.34 -0.17 0.09
-0.76 -0.15 0.87 -0.24 0.77 -2.97 -0.62 -0.22 0.18
-0.72
0.07 -0.92 -0.09 -1.71 0.40 -1.75 -0.97 2.72 -0.96 1.03
-0.70 -0.82 -1.12 0.01 -0.74 -2.91 -0.53 -0.60 -0.46
-0.72
-0.28 -0.83 -0.76 -2.79 -0.69 -3.15 -0.32 1.12 1.50
-0.72
...the singular values are:
>svd.Matrix(X)$values
[1] 8.1520312 6.9315984 4.6502211 3.7656658 2.9517747 2.0639984
1.5499911 1.0316472 0.8151062 0.3240471
...and the result of solve(.) is:
> solve(X)
Error in solve.qr: No data to interpret as logical value: if(a$rank
< (p <- da[2])) stop("apparently singular matrix")
Somebody can help?
Patrick
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news
|