[R] Linear regression on several groups

Eik Vettorazzi E.Vettorazzi at uke.uni-hamburg.de
Fri Aug 13 14:43:03 CEST 2010


hi,
maybe an ANCOVA is what you want, which is also done by lm in R

lm(y~x*z)



Am 12.08.2010 17:11, schrieb JesperHybel:
> 
> I have a simple dataset of a numerical dependent Y, a numerical independent X
> and a categorial variable Z with three levels. I want to do linear
> regression Y~X for each level of Z. How can I do this in a single command
> that is without using lm() applied three isolated times?


-- 
Eik Vettorazzi
Institut für Medizinische Biometrie und Epidemiologie
Universitätsklinikum Hamburg-Eppendorf

Martinistr. 52
20246 Hamburg

T ++49/40/7410-58243
F ++49/40/7410-57790



More information about the R-help mailing list