function [names]=genefactor(A,s,Des,ngene,j) % using factor loading matrix A, factor j, correlation vector s, % find the ngene genes most loaded on the factor, plot their % correlations in s against factor loadings, and return their names % [a,i]=sort(abs(A(:,j))); i=flipud(i); ind=i(1:ngene); scatter(A(ind,j),s(ind)); xlabel(['Loadings on factor',int2str(j)]) ylabel('Correlation with status') names=Des(ind,:); %