On Wed, Mar 16, 2011 at 3:18 AM, agent dunham <[email protected]> wrote:
> Does it mean that regsubsets doesn't work with categorical variables?
No.
> It's because I'm trying the following and I don't know what happens. Any
> help would be appreciated.
>
> varin <- data.frame(v1,v2,...,v7, factor1,..., factor4)
>
> Dependent variable: height
>
> Then:
>
> eu.subsets <- regsubsets(varinc , height,
> method=c("exhaustive"),nvmax=3,nbest =1)
>
> It gives me this errror:
>
> Error en leaps.setup(x, y, wt = weights, nbest = nbest, nvmax = nvmax, :
> character variables must be duplicated in .C / .Fortran
As the help says, the first argument x must be either a design matrix
or a model formula. If you want R to make a design matrix for
categorical variables for you, use a model formula
> By the way, if you introduce weights in regsubsets, is the same as doing
> some kind of robust regression?
No. It's weighted least squares.
-thomas
--
Thomas Lumley
Professor of Biostatistics
University of Auckland
______________________________________________
[email protected] 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.