[R] too many var in lm
carol white
wht_crl at yahoo.com
Wed Aug 17 16:39:39 CEST 2011
Thanks for your all replies.
Actually, I have more than this number of variables. I want to make a selection of variables with anova and I thought that I can apply anova to the object obtained by lm. The purpose is to select the genes discriminting control samples from disease.
Best,
Carol
----- Original Message -----
From: Eik Vettorazzi <E.Vettorazzi at uke.uni-hamburg.de>
To: carol white <wht_crl at yahoo.com>
Cc: "r-help at stat.math.ethz.ch" <r-help at stat.math.ethz.ch>
Sent: Wednesday, August 17, 2011 3:39 PM
Subject: Re: [R] too many var in lm
Hi Carol,
it might be another question if it is sensible to use 2100 regression
parameters, but you can use . to regress one response against all other
variables in a data frame as in:
lm(formula = mpg ~ ., data = mtcars)
and you can even exclude specific variables using "-"
lm(formula = mpg ~ . - wt, data = mtcars)
cheers.
Am 17.08.2011 15:23, schrieb carol white:
> Hello,
> It might be an easy question but if you have many variables to fit in the lm function, how do you take all without specifying var1+var2+...+var2100 in the terms parameter in response ~ terms?
>
> Cheers,
>
> Carol
>
> ______________________________________________
> 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.
--
Eik Vettorazzi
Department of Medical Biometry and Epidemiology
University Medical Center Hamburg-Eppendorf
Martinistr. 52
20246 Hamburg
T ++49/40/7410-58243
F ++49/40/7410-57790
More information about the R-help
mailing list