September 23, 2003

Dimensional MATLAB Reading

Played around a little more with MATAB, although I didn't really get very far. I was trying to figure out how to use dlmread to import my data files properly into MATLAB automatically. It didn't really seem to want to fly somehow.

I spent some time trying to figure out how to automate my MATLAB work. I couldn't figure out how to get it to import the tab-delimited data files that my programs had produced using the dlmread command which should put it into a matrix. I can do it via the clipboard but not anyway else at the moment. Reviewing various MATLAB tutorials on the web, looking for hints, I realized that I need to review my understanding and knowledge of matrices again, so I've added this to my list of things to be done.

Assuming that my methodology is correct, which it might not be, I can now map one MDS cluttering onto another using the Procrustes in MATLAB. I need to figure out now how to get a single measure of how different the two are from that. I'm at least further along than before, so that's promising.

This is my current revised program:

% Import anal1ahyp.txt into anal1a matrix variable. Do this first! It's not done
% automatically here. Need first to do something like anal1a = abs(100 - anal1a) to
% get proper dissimilarity values to work with. The default ones in the files don't
% work as is.

docs = {'g4c', 'pp1', 'pp2', 'msc', 'pl1', 'pl2', 'pl3', 'sp1', 'sp2', 'ac1', 'ac2', 'bws'};
[Anal1aMDS, eigvals] = cmdscale(Anal1aRaw);
plot(1:length(eigvals),eigvals,'bo-');
graph2d.constantline(0,'LineStyle',':','Color',[.7 .7 .7]);
axis([1,length(eigvals),min(eigvals),max(eigvals)*1.1]);
xlabel('Eigenvalue number');
ylabel('Eigenvalue');
plot(Anal1aMDS(:,1),Anal1aMDS(:,2),'bx');
axis(max(max(abs(Anal1aMDS))) * [-1.1,1.1,-1.1,1.1]); axis('square');
text(Anal1aMDS(:,1),Anal1aMDS(:,2),docs,'HorizontalAlignment','left');
hx = graph2d.constantline(0,'LineStyle','-','Color',[.7 .7 .7]);
hx = changedependvar(hx,'x');
hy = graph2d.constantline(0,'LineStyle','-','Color',[.7 .7 .7]);
hy = changedependvar(hy,'y');

% Import anal2ahyp.txt into anal2a matrix variable. Do this first! It's not done
% automatically here.

Anal2aRaw = abs(100 - Anal2aRaw);
[Anal2aMDS, eigvals] = cmdscale(Anal2aRaw);

% do procustes
[D,Z] = procrustes(Anal1aMDS, Anal2aMDS(:,1:2));
plot(Anal1aMDS(:,1), Anal1aMDS(:,2), 'bo', Z(:,1), Z(:,2), 'rd');
text(Anal1aMDS(:,1)+0.5,Anal1aMDS(:,2), docs, 'Color', 'b');
text(Z(:,1)+0.5,Z(:,2),docs, 'Color', 'r');
xlabel('East of the Sun');
ylabel('West of the Moon');
legend({'Anal1a', 'Anal2a'}, 4);

Posted by Michelle at September 23, 2003 05:15 PM | TrackBack
Comments
Post a comment




Remember me?

(You may use HTML tags for style)