Description 
% p = dunnett(stats, expt_idx, ctrl_idx)
% p is vector of pvalues for comparing experimental value(s) (expt_idx) w/ a single
% control value (ctrl_idx), corrected by the Dunnett multiple comparison test
% stats is output from anova1
% idx are indicies of means of interest within stats datastructure
% p = dunnett(stats), then ctrl_idx=1, expt_idx=2:length(stats.means)
% p = dunnett(stats, expt_idx), then ctrl_idx=1
% p = dunnett(stats, [], ctrl_idx), then expt_idx=1:length(stats.means), but NOT ctrl_idx
% p = Dunnett's probability for nonzero difference between ctrl_idx and expt_idx means
% Based on Behavior Research Methods & Instrumentation (1981), vol. 13 (3), 363366
% Dunlap, Marx, and Agamy Fortran IV source code adapted to Matlab
% The output from this function are consistent w/ the Dunnett test implemented in Prism 5.0a
%
% % Example
% % generate random data
% % groups ctrl and one are zero centered
% % groups two, three, and four are 2,3,4 centered respectively
%
% groupnames = {'ctrl','one','two','three','four'};
% datavector = [];
% k=1;
% for(i=1:length(groupnames))
% len = rand*20;
% while(len<10)
% len = rand*20;
% end
% if(i>2)
% datavector = [datavector i*rand(1,len)];
% else
% datavector = [datavector rand(1,len)];
% end
% for(j=1:len)
% group{k} = groupnames{i};
% k=k+1;
% end
% end
% [p,t,stats] = anova1(datavector,group); % perform oneway ANOVA
% p = dunnett(stats)
%
% p =
%
% NaN 0.9238 0.1639 0.0106 0.0002
%
% p(1) = 'ctrl' vs 'ctrl' = NaN pvalue
% p(4) means 'three' is different from 'ctrl' w/ pvalue 0.0106
% p(5) means 'four' is different from 'ctrl' w/ pvalue 0.0002
%
% Navin Pokala 2012
