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

1 Ansicht (letzte 30 Tage)
Niki am 4 Nov. 2016
Bearbeitet: Niki am 4 Nov. 2016
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
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;

Antworten (0)


Mehr zu Linear and Nonlinear Regression finden Sie in Help Center und File Exchange


Community Treasure Hunt

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

Start Hunting!

Translated by