how to search and keep all the possible combinations with a certain accuracy

1 次查看(过去 30 天)
I am trying to do some simple combination, I have a Matrix of X consists of 2000 variables and a Y I want to each time pick 4 of the variables from X and make a regression and keep only those sets that have higher R than 0.9 . I found another solution based on 3 matrices, what want is one matrix and I tried to amend the code but somewhat I did not get it right
tic
X1 = rand(40,2000);
Y = rand(40,1);
in = ones(40,1);
R = zeros(size(:,1),1);
for c = 1:size(:,1)
X = [in X1(:,i)];
yhat = X*(X\Y);
ybar = mean(Y);
ssr = norm(yhat - ybar)^2;
sst = norm(Y - ybar)^2;
R(c) = ssr/sst;
end
toc

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by