Code covered by the BSD License  

Highlights from
Factors on Demand

image thumbnail
from Factors on Demand by Attilio Meucci
Proper implementation of factor models: bottom-up estimation, top-down attribution

[Who, g]=ExactNChooseK(OutOfWho,K,M)
function [Who, g]=ExactNChooseK(OutOfWho,K,M)

Combos = nchoosek(OutOfWho,K);
L=size(Combos,1);
a=zeros(1,L);
for l=1:L
    a(l)=Goodness(Combos(l,:),M);
end
[g, Pick]=max(a);
Who=Combos(Pick,:);

Contact us at files@mathworks.com