[R] Is there an easy way to generate linearly independent ve

(Ted Harding) Ted.Harding at nessie.mcc.ac.uk
Fri Jun 18 10:15:38 CEST 2004


On 18-Jun-04 Fred wrote:
> I want to get linearly independent vectors, not orthogonal ones.
> The functions eigen, svd, I think it may provide orthogonal
> vectors which are not what I expect.

It depends what sort of characteristics you want your non-orthogonal
linearly independent vectors to have.

It's very easy to produce examples of such vectors: simple and
easy examples are like (e.g. for n=4)

  1 0 0 0
  1 1 0 0
  1 1 1 0
  1 1 1 1

or

  1 0 0 0
  1 1 0 0
  0 1 1 0
  0 0 1 1

and similar (all of which can be extended downwards arbitrarily
if you want n linearly independent vectors in k > n dimensions).

If these are too simplistic for you, please indicate how "interesting"
you want them to be.

The suggestions about using random numbers should work: it's not
likely that an NxN matrix of random numbers will be near singular,
so a test of the matrix to reject any which are too close is going
to be fairly efiicient.

E.g. you might consider a simple test like accepting the matrix M
if

  max(abs(eigen(M)$values)))/min(abs(eigen(M)$values))) < 10

(the "10" is arbitrary, for illustration).

Hope this helps,
Ted.


--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 167 1972
Date: 18-Jun-04                                       Time: 09:15:38
------------------------------ XFMail ------------------------------




More information about the R-help mailing list