[R] Is there an easy way to generate linearly independent vec tors
Fred
fzh113 at hecky.it.northwestern.edu
Fri Jun 18 03:54:38 CEST 2004
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.
----- Original Message -----
From: "Liaw, Andy" <andy_liaw at merck.com>
To: "'Jonathan Baron'" <baron at psych.upenn.edu>; "Fred"
<fzh113 at hecky.it.northwestern.edu>
Cc: "R-help mailing list" <r-help at stat.math.ethz.ch>
Sent: Thursday, June 17, 2004 7:50 PM
Subject: RE: [R] Is there an easy way to generate linearly independent vec
tors
> I believe eigen(), svd() and qr() can all do it.
>
> Andy
>
> > From: Jonathan Baron
> >
> > On 06/17/04 19:04, Fred wrote:
> > >Dear R-listers:
> > >
> > >I am trying to test an algorithm on a set of linearly
> > independent vectors
> > >{x1,x2,...,xn}.
> >
> > Well, here's an idea, for 10 vectors of length 10,
> > as columns of a matrix m1. The 11th seems to be needed.
> >
> > m1 <- matrix(rnorm(110),10,11)
> > for (i in 2:11) {
> > m1[,i] <- resid(lm(m1[,i] ~ m1[, 1:(i-1)]))
> > }
> >
> > Test it with cor(m1[,-11])
> >
> > I'm sure there are better ways.
> >
> > Of course
> > m1 <- matrix(rnorm(100),10,10)
> > is ALMOST what you want.
> >
> > Jon
> > --
> > Jonathan Baron, Professor of Psychology, University of Pennsylvania
> > Home page: http://www.sas.upenn.edu/~baron
>
>
> --------------------------------------------------------------------------
----
> Notice: This e-mail message, together with any attachments, contains
information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New
Jersey, USA 08889), and/or its affiliates (which may be known outside the
United States as Merck Frosst, Merck Sharp & Dohme or MSD and in Japan, as
Banyu) that may be confidential, proprietary copyrighted and/or legally
privileged. It is intended solely for the use of the individual or entity
named on this message. If you are not the intended recipient, and have
received this message in error, please notify us immediately by reply e-mail
and then delete it from your system.
> --------------------------------------------------------------------------
----
>
More information about the R-help
mailing list