Re: [R] summary many regressions

2013-11-26 Thread PIKAL Petr
project.org] On Behalf Of Gary Dong > Sent: Tuesday, November 26, 2013 12:36 AM > To: r-help@r-project.org > Subject: [R] summary many regressions > > Dear R users, > > I have a large data set which includes data from 300 cities. I want to > run a biviriate regression for e

Re: [R] summary many regressions

2013-11-25 Thread arun
Hi, Try: res <- do.call(rbind,lapply(split(data,data$city),function(z) {fit_city <- lm(y~x,data=z);data.frame(City=unique(z$city),Coefficient=coef(fit_city)[2],Adjusted_R_square= summary(fit_city)$adj.r.squared)})) A.K. On Monday, November 25, 2013 6:37 PM, Gary Dong wrote: Dear R users, I

Re: [R] summary many regressions

2013-11-25 Thread David Winsemius
On Nov 25, 2013, at 3:35 PM, Gary Dong wrote: > Dear R users, > > I have a large data set which includes data from 300 cities. I want to run > a biviriate regression for each city and record the coefficient and the > adjusted R square. > > For example, in the following, I have 10 cities represe

[R] summary many regressions

2013-11-25 Thread Gary Dong
Dear R users, I have a large data set which includes data from 300 cities. I want to run a biviriate regression for each city and record the coefficient and the adjusted R square. For example, in the following, I have 10 cities represented by numbers from 1 to 10: x = cumsum(c(0, runif(999, -1,