% % Problem epage 70 % Example epage 51 % % 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; X = data; [n,p] = size(X); % [n,p] = [number of samples=384; dimension of each sample=17] % Normalize columns (the z-scores): X = X - repmat(mean(X),size(X,1),1); X = X ./ repmat(std(X),size(X,1),1); % with the pre-calculations above this matrix is the correlation matrix ... covm = cov( X ); [eigvec,eigval] = eig( covm ); eigval = diag(eigval); % Order in decending order: eigval = flipud(eigval); eigvec = eigvec(:,p:-1:1); transformX = X * eigvec; % Plot a scree plot: figure; plot( eigval, '-ok' ); title( 'scree plot' ); % Plot the slopes in the scree plot: eigSlopes = abs( diff( eigval ) ); figure; plot( eigSlopes, '-ok' ); xlabel( 'eigen component' ); title( 'absolute scree difference' );