[R] Matrix stability problem

From: Lapointe, Pierre <Pierre.Lapointe_at_nbf.ca>
Date: Wed 15 Jun 2005 - 07:45:25 EST


Hello,

This is not a problem with R, the calculated results are mathematically correct. This a matrix stability problem. Because of measuring errors, my matrix solution is a bit off.

Here is what my equations look like:

A11 x11+A12 x12 +A13 x13 = b1  
A21 x21+A22 x21 +A23 x23 = b2  
A31 x31+A32 x31 +A33 x33 = b3 

A is a reading, X is a measured weight, and b is total. The 3 experiments give slightly different X values because of measurement errors. For reproducibility, here's my A, x and b matrices and vectors A <-matrix(
c(0.03,0.02,0.04,0.01,0.015,0.03,-0.01,-0.02,0.03),3,3,byrow=TRUE) x <-matrix( c(0.2,0.3,0.5,0.205,0.305,0.49,0.19,0.29,0.52),3,3,byrow=TRUE) b <-matrix( c(0.032,0.021325,0.0079),3,1) As expected, rowSums(A*x) = b
Problem: Let's now assume I don't know x. I'd like to solve for x in Ax=b. I am aware that my x is a matrix and solve(A,b) will give me a vector. However, looking at the x matrix, one can easily see that the real x[,1] (without measurement error) is close to 0.2, x[,2] is close to 0.3 and x[,3] is close to 0.5
> x

      [,1] [,2] [,3]
[1,] 0.200 0.300 0.50
[2,] 0.205 0.305 0.49
[3,] 0.190 0.290 0.52

However, solve(A,b) gives me a vector that is not close to the expected solution: > solve(A,b)

          [,1]
[1,] 0.2140000
[2,] 0.2612857 # Far from 0.2
[3,] 0.5088571

Do you know any function/package in R that could help me get a result closer to the expected one?

Regards,

Pierre Lapointe



AVIS DE NON-RESPONSABILITE:\ Ce document transmis par courri...{{dropped}}

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Jun 15 07:49:15 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:38 EST