[R] Combination diffrent variables ,how to calculates

2007-01-22 Thread anil kumar rohilla
Hi, List , i have 6 predictor variables and i want to make possible combinations of these 6 predictors ,all the data is in matrix form , if i am having 6 predictors than possible combination of sets are 64 2 power 6, or 63 ,whatever it may be i want to store the result in another variable to

[R] Combination of variables

2007-01-22 Thread anil kumar rohilla
Hi, List , i have 6 predictor variables and i want to make possible combinations of these 6 predictors ,all the data is in matrix form , if i am having 6 predictors than possible combination of sets are 64 2 power 6, or 63 ,whatever it may be i want to store the result in another variable to

Re: [R] Combination of variables

2007-01-22 Thread David Barron
You don't say what model you want to do. It isn't necessary to store each combination of predictors in a separate matrix unless you really need to do this for some other reason, in which case I imagine you could adopt this idea. I dare say there are better ways, but this should work (assuming you

Re: [R] Combination of variables

2007-01-22 Thread hadley wickham
You might find the following code useful. It's part of a package I'm developing for interactive model exploration. Hadley # Generate all models # Fit all combinations of x variables ($2^p$) # # This technique generalises \code{\link{fitbest}}. While it is much # slower it will work for any