% % problem epage: % example epage: % % Written by: % -- % John L. Weatherwax 2005-08-14 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- addpath( '../../Code/eda_data' ); close all; drawnow; clc; clear; load yeast; [n,p] = size(data); datac = data - repmat(sum(data)/n,n,1); %com = cov(datac); % Find the covariance matrix: com = corrcoef(datac); % Find the correlation matrix: [eigvec,eigval] = eig(com); eigval = diag(eigval); % Order in decending order: eigval = flipud(eigval); eigvec = eigvec(:,p:-1:1); % Do a scree plot of this data: fh=figure; plot(1:length(eigval),eigval,'ko-'); hold on; grid on; % Compute the same for random variables: data2 = randn(n,p); com = cov(data2); [eigvec,eigval] = eig(com); eigval = diag(eigval); % Order in decending order: eigval = flipud(eigval); eigvec = eigvec(:,p:-1:1); % Add to the original scree plot: figure(fh); plot(1:length(eigval),eigval,'r.-'); hold on; title( 'Yeast-Random scree plot' ); saveas( gcf, '../../WriteUp/Graphics/Chapter2/prob_2_2_scree', 'eps' );