[R] linear regression in a ragged array

Marcel Curlin cemarcel at u.washington.edu
Mon Mar 21 10:25:41 CET 2011


Hello,
I have a large dataset of the form

subj   var1   var2   
001    100    200
001    120    226
001    130    238
001    140    245
001    150    300
002    110    205
002    125    209
003    101    233
003    115    254

I would like to perform linear regression of var2 on var1 for each subject
separately. It seems like I should be able to use the tapply function as you
do for simple operations (like finding a mean of var1 for each subject), but
I am not sure of the correct syntax for this. Is there a way to do this?

Many thanks, Marcel

--
View this message in context: http://r.789695.n4.nabble.com/linear-regression-in-a-ragged-array-tp3393033p3393033.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list