Re: [R] linear regression for grouped data

2010-12-30 Thread Michael Dewey
At 02:23 29/12/2010, Entropi ntrp wrote: Hi, I have been examining large data and need to do simple linear regression with the data which is grouped based on the values of a particular attribute. For instance, consider three columns : ID, x, y, and I need to regress x on y for each distinct val

Re: [R] linear regression for grouped data

2010-12-29 Thread entropy
Thanks alot for the quick responses. I have some additional questions related to this topic. In fact, my intention was to be able to answer questions like what percent of the regressions have p_values less than a certain threshold, how do residuals look like, how do the plots of y vs. x look like,

Re: [R] linear regression for grouped data

2010-12-28 Thread Dennis Murphy
Hi: There are some advantages to taking a plyr approach to this type of problem. The basic idea is to fit a linear model to each subgroup and save the results in a list, from which you can extract what you want piece by piece. library(plyr) # One of those SAS style data sets... > df <- data.fram

Re: [R] linear regression for grouped data

2010-12-28 Thread Bill.Venables
library(nlme) lmList(y ~ x | factor(ID), myData) This gives a list of fitted model objects. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Entropi ntrp Sent: Wednesday, 29 December 2010 12:24 PM To: r-help@r-project.org Subject:

Re: [R] linear regression for grouped data

2010-12-28 Thread David Winsemius
On Dec 28, 2010, at 9:23 PM, Entropi ntrp wrote: Hi, I have been examining large data and need to do simple linear regression with the data which is grouped based on the values of a particular attribute. For instance, consider three columns : ID, x, y, and I need to regress x on y for ea