Re: [R] rolling regression between adjacent columns

2008-07-30 Thread Gabor Grothendieck
I was hoping for something reproducible. I can't run your code or make use of the data to save time in creating an example. Try this with builtin anscombe: > nc <- ncol(anscombe) > sapply(seq(1, nc, 2), function(i) coef(lm.fit(cbind(1, anscombe[,i]), > anscombe[,i+1]))) [,1] [,2] [,3]

Re: [R] rolling regression between adjacent columns

2008-07-30 Thread rcoder
Well, in this case I don't think my original code would have helped much... So, I've rewritten as below. I want to perform regression between one column in a matrix and all other columns in the same matrix. I have a for loop to achieve this, which succeeds in exporting intercept and slope coeffic

Re: [R] rolling regression between adjacent columns

2008-07-29 Thread Gabor Grothendieck
Read the last line of every message to r-help. On Tue, Jul 29, 2008 at 6:15 PM, rcoder <[EMAIL PROTECTED]> wrote: > > Hi everyone, > > I am trying to apply linear regression to adjacent columns in a matrix (i.e. > col1~col2; col3~col4; etc.). The columns in my matrix come with identifiers > at the