Re: [R] Matrix stability problem

From: Huntsinger, Reid <>
Date: Wed 15 Jun 2005 - 08:48:25 EST

It looks to me like the x measurements are normalized to sum to 1. So whatever measurement error there is gets "spread around", so to speak.

It would help if you could explain the setting a little more fully? Why is it, for example, that you know the A values from experiment to experiment (they do seem to vary) but there's no measurment error? Why the variation? Do you know b, or is it an estimate from some measurements x and readings A?

I guess this is probably a (multivariate-response) regression problem, and the question is where the error is and what its structure is. Imposing the constraint that x sums to 1 would probably help. This makes an overdetermined problem (two free parameters, three experiments) so you are forced into regression.

Would you ever have more than three experiments? If so would that change the formulation of the problem? More experiments + regression might be the simplest way to get a more accurate solution.

Reid Huntsinger

-----Original Message-----
[] On Behalf Of Lapointe, Pierre
Sent: Tuesday, June 14, 2005 5:45 PM
To: ''
Subject: [R] Matrix stability problem


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,] 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?


Pierre Lapointe

AVIS DE NON-RESPONSABILITE:\ Ce document transmis par courri...{{dropped}} mailing list PLEASE do read the posting guide! mailing list PLEASE do read the posting guide! Received on Wed Jun 15 08:52:14 2005

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