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

2 visualizaciones (últimos 30 días)
Niki
Niki el 4 de Nov. de 2016
Editada: Niki el 4 de Nov. de 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
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

Respuestas (0)

Categorías

Más información sobre Descriptive Statistics en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by