teststat

teststat - teststat EEGLAB statistical testing function...

This preview shows pages 1–3. Sign up to view the full content.

% teststat - EEGLAB statistical testing function % % Statistics are critical for inference testing in Science. It is thus % primordial to make sure than all the statistics implemented are % robust and at least bug free. Statistical function using complex % formulas are inherently prone to bugs. EEGLAB functions are all the % more prone to bugs given that they only use complex Matlab code to % avoid loops and speed up computation. % % This test function does not garantee that EEGLAB statistical functions % are bug free. It does assure though that bugs are unlikely and minor % if they are present. % % This function test 3 things. % % * First, it checks that for vector inputs the EEGLAB functions return % the same output as other reference functions from the Matlab statistical % toolbox or from other packages tested against the SPSS software for % repeated measure ANOVA (rm_anova2 function). % % * Second, it checks that array inputs with different number of dimensions % (from 1 to 3) the EEGLAB function return the same output. % % * Third, it checks that the permutation and bootstrap methods shuffle % the data properly by running multiple tests. function teststat; % testing paired t-test % --------------------- a = { rand(1,10) rand(1,10)+0.5 }; [t df pvals surog] = statcond(a, 'mode', 'param', 'verbose', 'off', 'paired', 'on'); [h p tmp stats] = ttest(a{1}, a{2}); fprintf('Statistics paired statcond t-value %2.2f df=%d p=%0.4f\n', t, df, pvals); fprintf('Statistics paired ttest func. t-value %2.2f df=%d p=%0.4f\n', stats.tstat, stats.df, p); assertsame([t stats.tstat], [df stats.df], [pvals p]); disp('--------------------'); % testing unpaired t-test % ----------------------- [t df pvals surog] = statcond(a, 'mode', 'param', 'verbose', 'off', 'paired', 'off'); [h p tmp stats] = ttest2(a{1}, a{2}); fprintf('Statistics paired statcond t-value %2.2f df=%d p=%0.4f\n', t, df, pvals); fprintf('Statistics paired ttest2 func. t-value %2.2f df=%d p=%0.4f\n', stats.tstat, stats.df, p); assertsame([t stats.tstat], [df stats.df], [pvals p]); disp('--------------------'); % testing paired 1-way ANOVA % -------------------------- a = { rand(1,10) rand(1,10) rand(1,10)+0.2; rand(1,10) rand(1,10)+0.2 rand(1,10) }; [F df pvals surog] = statcond(a(1,:), 'mode', 'param', 'verbose', 'off', 'paired', 'on'); z = zeros(10,1); o = ones(10,1); t = ones(10,1)*2;

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
stats = rm_anova2( [ a{1,1}';a{1,2}';a{1,3}'], repmat([1:10]', [3 1]), [o;o;o], [z;o;t], {'a','b'}); fprintf('Statistics 1-way paired statcond F-value %2.2f df1=%d df2=%d p= %0.4f\n', F, df(1), df(2), pvals); fprintf('Statistics 1-way paired rm_avova2 func. F-value %2.2f df1=%d df2=%d p= %0.4f\n', stats{3,5}, stats{3,3}, stats{6,3}, stats{3,6}); assertsame([F stats{3,5}], [df(1) stats{3,3}], [df(2) stats{6,3}], [pvals stats{3,6}]); disp('--------------------'); % testing paired 2-way ANOVA % -------------------------- [F df pvals surog] = statcond(a, 'mode', 'param', 'verbose', 'off', 'paired', 'on'); z = zeros(10,1); o = ones(10,1); t = ones(10,1)*2;
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 08/29/2011 for the course CHE 10 taught by Professor Toupadakis during the Spring '08 term at UC Davis.

Page1 / 9

teststat - teststat EEGLAB statistical testing function...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online