% % 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. % %----- close all; drawnow; rehash; clc; clear; addpath( '../../Code/eda_data' ); addpath( '../../Code/eda_toolbox' ); addpath( '../Chapter1' ); % Example 8.1 % First load the data. load leukemia [n,p] = size(leukemia); x = zeros(n,p); % Standardize each row (gene) to be mean % zero and standard deviation 1. for i = 1:n sig = std(leukemia(i,:)); mu = mean(leukemia(i,:)); x(i,:) = (leukemia(i,:) - mu)/sig; end % Do hierarchical clustering. Y = pdist(x); Z = linkage(Y,'complete'); [H, T] = dendrogram(Z,15); title('Leukemia Data') % Example 8.3 % Use same leukemia data set % and matrix Z from Example 8.1. % The second argument is the dendrogram distance. The % third argument is a string % specifying what information % the second argument provides. %%%%%rectplot(Z,15,'nclus') rectplot(Z,13.0,'dis'); % We now see how this rectplot shows the original cancer type. % labs = zeros(length(cancertype),1); % Now find all of the AML cancers. % Set them equal to 1. inds = strmatch('AML',cancertype); labs(inds) = 1; % Now do the rectangle plot. %%%%%rectplot(Z,15,'nclus',labs) rectplot(Z,13.0,'dis',labs) saveas( gcf, '../../WriteUp/Graphics/Chapter8/prob_8_4_rectplot', 'epsc' );