[R] Linear regression on several groups

Derek Ogle DOgle at northland.edu
Fri Aug 13 16:03:21 CEST 2010


Have a look at lmList() in the nlme package.

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of JesperHybel
> Sent: Friday, August 13, 2010 7:56 AM
> To: r-help at r-project.org
> Subject: Re: [R] Linear regression on several groups
> 
> 
> Example is spot on - sr for not providing one myself.
> The results you calculate are what I'm looking for.
> 
> Would like a function F where I could type:
> 
> F(weight ~ Time, data = ChickWeight, SOME ARGUMENT = Diet))
> 
> Resulting in
> 
> for (i in 1:4){
> print(
> 
> lm(weight ~ Time, data = ChickWeight, subset = Diet==i)
> 
> )
> }
> 
> I'm simply trying to minimize amount of looping and typing etc.
> 
> BR Jesper
> 
> 
> 
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/Linear-
> regression-on-several-groups-tp2322835p2324154.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list