Stepwise regression for multivariate case in R?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Stepwise regression for multivariate case in R?

Jonathan Jansson
Hi! I am trying to make a stepwise regression in the multivariate case, using Wilks' Lambda test.
I've tried this:
>  greedy.wilks(cbind(Y1,Y2) ~ . , data=my.data )
But it only returns:
Error in model.frame.default(formula = X[, j] ~ grouping, drop.unused.levels = TRUE) :
  variable lengths differ (found for 'grouping')
What can be wrong here? I have checked and all variables in my.data is of the same length.
//Jonathan
     
        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Stepwise regression for multivariate case in R?

Frank Harrell
Since stepwise methods do not work as advertised in the univariate case I'm wondering why they should work in the multivariate case.
Frank
Jonathan Jansson wrote
Hi! I am trying to make a stepwise regression in the multivariate case, using Wilks' Lambda test.
I've tried this:
>  greedy.wilks(cbind(Y1,Y2) ~ . , data=my.data )
But it only returns:
Error in model.frame.default(formula = X[, j] ~ grouping, drop.unused.levels = TRUE) :
  variable lengths differ (found for 'grouping')
What can be wrong here? I have checked and all variables in my.data is of the same length.
//Jonathan
     
        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Frank Harrell
Department of Biostatistics, Vanderbilt University
Reply | Threaded
Open this post in threaded view
|

Re: Stepwise regression for multivariate case in R?

Uwe Ligges-3
In reply to this post by Jonathan Jansson


On 26.04.2013 13:58, Jonathan Jansson wrote:
> Hi! I am trying to make a stepwise regression in the multivariate case, using Wilks' Lambda test.
> I've tried this:
>>   greedy.wilks(cbind(Y1,Y2) ~ . , data=my.data )
> But it only returns:
> Error in model.frame.default(formula = X[, j] ~ grouping, drop.unused.levels = TRUE) :
>    variable lengths differ (found for 'grouping')
> What can be wrong here? I have checked and all variables in my.data is of the same length.

Simply answer: It was never intended to work for the multivariate case.
I will add a stop() with a better error message.

Best,
Uwe Ligges







> //Jonathan
>    
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.
>

______________________________________________
[hidden email] 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.