[R] Variable selection from given data

David Winsemius dwinsemius at comcast.net
Fri Oct 31 07:30:18 CET 2014


Untested and with the presumption that you have the appropriate package loaded:

sapply(1:15, function(x) qr(y ~ ., df[-grep(paste0(“x”,i)]) )


> On Oct 30, 2014, at 11:14 PM, Preetam Pal <lordpreetam at gmail.com> wrote:
> 
> Hi,
> 
> I am doing quantile regression of y on a set of 15 explanatory variables x1, x2,....x15. I want to run 15 regression models where in the i-th model, y would be regressed on all x variables except x-i. Then I would compare the results. At this point, I donot know how to create the 15 data sets by dropping the individual x variables. Any help to create the corresponding data sets would be appreciated. I am new to R or general coding.
> Thanks,
> Preetam
> 	[[alternative HTML version deleted]]
> 
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html

The posting guide requests that you learn to post in plain text.

> and provide commented, minimal, self-contained, reproducible code.

… and provide an example to get tested code.


David Winsemius, MD
Alameda, CA, USA



More information about the R-help mailing list