Re: [R] Using lm with a matrix?

2008-06-13 Thread jonboym
Many thanks, works great! Charilaos Skiadas-3 wrote: Try this: lapply( 1:2, function(i) lm( y~x, data=list(x=xdat[,i], y=ydat[,i]) ) ) Haris Skiadas -- View this message in context: http://www.nabble.com/Using-lm-with-a-matrix--tp17708207p17829661.html Sent from the R help mailing

[R] Using lm with a matrix?

2008-06-07 Thread jonboym
I'm trying to do a linear regression between the columns of matrices. In example below I want to regress column 1 of matrix xdat with column1 of ydat and do a separate regression between the column 2s of each matrix. But the output I get seems to give correct slopes but incorrect intercepts and

Re: [R] Using lm with a matrix?

2008-06-07 Thread Charilaos Skiadas
On Jun 7, 2008, at 8:13 AM, jonboym wrote: I'm trying to do a linear regression between the columns of matrices. In example below I want to regress column 1 of matrix xdat with column1 of ydat and do a separate regression between the column 2s of each matrix. But the output I get