[R] Leaps & regsubsets

Spencer Graves spencer.graves at pdf.com
Wed Mar 2 17:32:02 CET 2005


      I can't help you answer your specific question, but after you 
figure it out, would you please rerun the analysis, say, 1,000 times 
after randomly permuting your response variable each time (or bootstrap 
sampling therefrom).  I would be interested in your comparison of your 
actual results with the Monte Carlo / bootstrap. 

      spencer graves

Smit, Robin wrote:

>Hello
> 
>I am trying to use all subsets regression on a test dataset consisting
>of 11 trails and 46 potential predictor variables. 
>I would like to use Mallow's Cp as a selection criterion. 
>The leaps function would provide the required output but does not work
>with this many variables (see below).
>The alternative function regsubsets should be used, but I am not able to
>define the function in such a way that is gives satisfactory results.
> 
>
>library(leaps)
>
>data <- read.table('C:/test_plot_sum2.txt', header = TRUE)
>
>attach(data)
>
>nox <- data[,1]
>
>cnt <- data[,2]
>
>vars <- data[,3:48]
>
> 
>
>leaps.setup(x = vars, y = nox, wt = cnt, nvmax = 1)
>
>leaps(x = vars, y = nox, wt = cnt, method = "Cp", nbest = 2, names =
>names(vars))
>
> 
>
>Error in leaps(x = vars, y = nox, wt = cnt, method = "Cp", nbest = 2,  :
>
>
>        leaps does not allow more than 31 variables; use regsubsets()
>
> 
>
>regsubsets(x = vars, y = nox, weights = cnt, method = "seqrep", nbest =
>1, names = names(vars), nvmax = 3)
>
> 
>
>1 subsets of each size up to 4
>
>Selection Algorithm: 'sequential replacement'
>
>Warning message: 
>
>37  linear dependencies found in: leaps.setup(x, y, wt = weights, nbest
>= nbest, nvmax = nvmax,  
>
> 
>Is there someone who could shine a few rays of light on this?
>Many thanks for your assistance.
> 
>Kind regards,
>Robin Smit
>
>This e-mail and its contents are subject to the DISCLAIMER at http://www.tno.nl/disclaimer/email.html
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>  
>




More information about the R-help mailing list