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 ______________________________________________ R-help@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.