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
The most elegant solution is going to depend on where you data comes from, but one way to do it if you have a matrix of data: D = cbind(rcauchy(100), matrix(runif(100*50),ncol=50)) # Some nonsense data lm(D[,1] ~ D[,-1]) If you let us know how your data is set up, a more specific response can be given. Hope this helps, Michael Weylandt On Wed, Aug 17, 2011 at 9:23 AM, carol white <wht_crl@yahoo.com> wrote:> 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@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. >[[alternative HTML version deleted]]
another approach is: Df <- as.data.frame(cbind(rcauchy(100), matrix(runif(100*50), ncol = 50))) fit <- lm(V1 ~ ., data = Df) fit I hope it helps. Best, Dimitris On 8/17/2011 3:28 PM, R. Michael Weylandt wrote:> The most elegant solution is going to depend on where you data comes from, > but one way to do it if you have a matrix of data: > > D = cbind(rcauchy(100), matrix(runif(100*50),ncol=50)) # Some nonsense data > lm(D[,1] ~ D[,-1]) > > If you let us know how your data is set up, a more specific response can be > given. > > Hope this helps, > > Michael Weylandt > > On Wed, Aug 17, 2011 at 9:23 AM, carol white<wht_crl at yahoo.com> wrote: > >> 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. >> > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. >-- Dimitris Rizopoulos Assistant Professor Department of Biostatistics Erasmus University Medical Center Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands Tel: +31/(0)10/7043478 Fax: +31/(0)10/7043014 Web: http://www.erasmusmc.nl/biostatistiek/
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
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
On Aug 17, 2011, at 10:39 AM, carol white wrote:> 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. >You need to consult a statistician with experience in this area. -- David.> 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 > > > ______________________________________________ > 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.David Winsemius, MD West Hartford, CT
Hi Carol, I unsuccessfully tried to get credits right for the following quote (and they make a lot of fuzz about having citations right around here), so I have to stick with the plain line: "Statistics means never having to say you're certain". Bioconductor has a mailing list on its own, there might be more qualified advice. Best. Am 18.08.2011 14:18, schrieb carol white:> Thanks Eik for your reply. > > Sure I know the classification method. However, at this stage, I'm working on feature selection. So lmfit and eBays in Limma are more preferable than anova in stats? > > > Best wishes, > > Haleh > > > > ----- Original Message ----- > From: Eik Vettorazzi <E.Vettorazzi at uke.uni-hamburg.de> > To: carol white <wht_crl at yahoo.com> > Cc: > Sent: Thursday, August 18, 2011 10:56 AM > Subject: Re: [R] too many var in lm > > Hi Carol, > methods for classifying observations are legion, starting from logistic > regression, discriminant analysis, CART, (hierarchical) cluster analysis... > > When it comes to analysing gene expressions, www.bioconductor.org might > be the place to visit, especially the limma-package might be promising. > > Regards, > Eik > > > Am 18.08.2011 10:30, schrieb carol white: >> Thanks Eik for your reply. >> >> I have seen that one way to select variables discriminating 2 categories of patients is anova. I saw that the anova function should be applied to an object like the one obtained from lm. so that's why I wanted to apply anova(lm(y~.)). Would you have any suggestions, comments? >> >> Regards, >> >> 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
Hello, Is Sys.unsetenv the right function to unset the proxy in R? Cheers, Carol
On Oct 31, 2011, at 13:25 , carol white wrote:> Hello, > > Is Sys.unsetenv the right function to unset the proxy in R? > >Possibly, but changing the subject of an earlier thread is not the right way to pose a question on R-help... (Send a new message. Replying to an old one causes the new one to be part of the older thread for people using threading mail clients. Worse, at least with OSX Mail, the subject of the thread is changed, so the thread on "too many var in lm" is now "unset proxy in R".) -- Peter Dalgaard, Professor Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
My apologies for having interfered with an existing thread. Any other proposition to unset the proxy in R is welcome. Cheers, Carol ----- Original Message ----- From: peter dalgaard <pdalgd at gmail.com> To: carol white <wht_crl at yahoo.com> Cc: "r-help at stat.math.ethz.ch" <r-help at stat.math.ethz.ch> Sent: Monday, October 31, 2011 1:44 PM Subject: Re: [R] unset proxy in R On Oct 31, 2011, at 13:25 , carol white wrote:> Hello, > > Is Sys.unsetenv the right function to unset the proxy in R? > >Possibly, but changing the subject of an earlier thread is not the right way to pose a question on R-help... (Send a new message. Replying to an old one causes the new one to be part of the older thread for people using threading mail clients. Worse, at least with OSX Mail, the subject of the thread is changed, so the thread on "too many var in lm" is now "unset proxy in R".)? -- Peter Dalgaard, Professor Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd.mes at cbs.dk? Priv: PDalgd at gmail.com