An embedded and charset-unspecified text was scrubbed... Name: not available Url: https://stat.ethz.ch/pipermail/r-help/attachments/20040617/812e56ab/attachment.pl
Is there an easy way to generate linearly independent vectors
2 messages · Fred, 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