% Stroke Lesions Data
% (C) 2013 Moo K. Chung 
%       mkchung@wisc.edu
% University of Wisconsin-Madison


% unsmoothed version
[pvalue Zvalue] = stat_proportion(group1, group2);

% smoothed version
FWHM=10; % smooth with 10mm full width at half maximum kernel

group1smooth= stat_smooth(group1, FWHM);
group2smooth=stat_smooth(group2, FWHM);
[pvalue Zvalue] = stat_proportion(group1smooth, group2smooth);

%------------------------
%multiple comparisoins correction for one sample 
% This example does not show any group difference

% testing on group1 should not show the result
%There is no significant signal

[pvalue Zvalue] = stat_proportion(group1, []);

[pvalue Zvalue] = stat_proportion(group1smooth, []);
pcorrected=stat_Zcorrected2D(Zvalue, FWHM);

subplot(2,2,4); imagesc(pcorrected);  axis square; axis off; colorbar
title('p-value (corrected)')


% testing on group2 should show the result
% There is signal on the right hemesphere. 
[pvalue Zvalue] = stat_proportion(group2, []);
pcorrected=stat_Zcorrected2D(Zvalue, FWHM);
figure; imagesc(pcorrected); colormap('hot'); colorbar; 

[pvalue Zvalue] = stat_proportion(group2smooth, []);
pcorrected=stat_Zcorrected2D(Zvalue, FWHM);
subplot(2,2,4); imagesc(pcorrected);  axis square; axis off; colorbar
title('p-value (corrected)')
    

%----------------------------
% multiple comparisons correction for two sample
% testing on group 1 and group 2 differences. 
% There is no significant group differences
[pvalue Zvalue] = stat_proportion(group0smooth, group1smooth);
pcorrected=stat_Zcorrected2D(Zvalue,  FWHM);
figure; imagesc(pcorrected); colormap('hot'); colorbar; 
caxis([0 0.1])

figure_bg('w')
print_jpg('stroke-corrected')
