How to establish all possible combinations of 4 variables out of 6 ?

The main idea is to gather possible combinations of 4 variable out of 6 total design variables. For every combination i will calculate the R square (with my response variable) and then discard the ones that doesn't meet the required R. I also want to do a t-test and a f-test to keep only the best combination at a given time. Given the best combination, i will then obtain the betas of these variables!

 採用された回答

Jonathan Epperl
Jonathan Epperl 2013 年 5 月 23 日

0 投票

Sounds like you are looking for nchoosek: http://www.mathworks.com/help/matlab/ref/nchoosek.html

4 件のコメント

Simon
Simon 2013 年 5 月 23 日
編集済み: Simon 2013 年 5 月 23 日
Thank you for your answer. It did not help me much though. This formulae seems to give me the number of combination possible, however i'm looking for all of them. For exemple: my variable are TSX, SPX and DXY and i would want all combinations of 2 of them. [TSX SPX], [TSX DXY], [SPX DXY]
Jonathan Epperl
Jonathan Epperl 2013 年 5 月 23 日
Yeah, you should probably read past the 1st line in the help, the 2nd usage of nchoosek does exactly that:
nchoosek({'TSX', 'SPX','DXY'},2)
Of course, rather than doing that with the names of your variables, you probably want to do it with some index, but I'll leave that up to you.
Simon
Simon 2013 年 5 月 24 日
LOL ok im noob thanks for the info !! You just made my day
Simon
Simon 2013 年 5 月 24 日
So i've made COMBO = nchoosek({V1,V2,V3,V4,V5,V6},4) and i was wondering if it was possible (without looping) to calculate the R square on each combination^

サインインしてコメントする。

その他の回答 (1 件)

andrea84
andrea84 2013 年 5 月 23 日

0 投票

I believe you need something like this :
v=[var1 var2 var3 var4 var5 var6];
combinations=nchoosek(v,4)

4 件のコメント

Simon
Simon 2013 年 5 月 23 日
Won<t work apparently because "v" has to be a scalar or a vector -.- I need a coffee haha
Simon
Simon 2013 年 5 月 23 日
Maybe the problem is that all of my variables have at least 200 data in each^^
andrea84
andrea84 2013 年 5 月 24 日
So you want to pick only one value of k variable out of the n total variables ?
Simon
Simon 2013 年 5 月 24 日
Thank you!

サインインしてコメントする。

カテゴリ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by