Hello, I'd like to repeat a linear regression model for groups of rows that are identified by an ID number. My table is like this: ID Y X1 X2 X3 X4 1 555 111 222 333 456 1 345 234 445 543 33 1 456 353 453 456 333 2 562 118 229 340 463 2 352 241 452 550 40 2 463 360 460 463 340 3 .... ... ... ... .... 3 3
I want to obtain an estimate of the linear model for each ID. ex. y = a1X1 + b1X2 + c1X3 + d1X4 where ID= 1 y = a2X1 + b2X2 + c2X3 + d2X4 where ID= 2 and so on... I'd like to obtain a table such this: ID a b c d 1 ... ... ... .. 2 .. .. .. .. 3 .. .. .. .. Can you sugget me something? Can I use a "for" script? Thank you very much! Valeria [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.