[R] help on regression by subsets in dataset

Dimitris Rizopoulos dimitris.rizopoulos at med.kuleuven.be
Mon Aug 8 13:51:43 CEST 2005


you could use function lmList() from the nlme package, i.e.,

dat <- data.frame(y = rnorm(120), x = runif(120, -3, 3), g = rep(1:3, 
each = 40))
############
library(nlme)
m <- lmList(y ~ x | g, data = dat)
m
summary(m)

I hope it helps.

Best,
Dimitris

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.be/biostat/
     http://www.student.kuleuven.be/~m0390867/dimitris.htm


----- Original Message ----- 
From: "Krishna" <snvk4u at gmail.com>
To: <r-help at stat.math.ethz.ch>
Sent: Monday, August 08, 2005 12:20 PM
Subject: [R] help on regression by subsets in dataset


> Hi Everyone
>
> May I request for a small help while performing the regression 
> analysis.
>
> I would like to know is there any possibility of conducting the
> regression for different data subsets (in the same data file),
> classified on the basis of "grouping variable". The alternative for
> this is running the regression for n number of times which you all
> know is quite cumbersome.
>
> Thank you for your kind attention and help
>
> rgds
>
> krishna
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list