Home > BauerLab > MATLAB > lib > +mouse > +stat > clusterTestKim.m

clusterTestKim

PURPOSE ^

clusterTest Takes in t-statistics for null hypothesis and for test

SYNOPSIS ^

function [cluster_loc, cluster_p, cluster_t, tDist] = clusterTestKim(nullMatrix,testMatrix,tThrMatrix)

DESCRIPTION ^

clusterTest Takes in t-statistics for null hypothesis and for test
   [cluster_loc, cluster_p, significant, cluster_t, tDist] = clusterTestMaris(nullMatrix,testMatrix,t_thr)
   Inputs:
      nullMatrix = a x b x iterations, where a and b are usually (frequency,
      time), (time, electrode), (frequency, frequency), etc. Iterations is
      the number of shuffled data analyzed. We expect nullMatrix to be
      t-values from shuffled data.
      testMatrix = a x b. The test matrix that will be tested against null
      hypothesis
      t_thr = threhold for t-value. If the t-value is above t_thr, then that
      data point will be included in the cluster.
   Outputs:
       cluster_loc
       cluster_p
       cluster_t
       tDist

   Modification of Maris "Nonparametric statistical testing of EEG- and
   MEG-data." J Neurosci Methods (2007)
   The modification is that all null t-statistics are considered instead
   of the highest value. An important point to make is that the p-values
   are now subject to multiple-comparisons, so holm-bonferroni test should
   be done on the p-value outputs.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [cluster_loc, cluster_p, cluster_t, tDist] = clusterTestKim(nullMatrix,testMatrix,tThrMatrix)
0002 %clusterTest Takes in t-statistics for null hypothesis and for test
0003 %   [cluster_loc, cluster_p, significant, cluster_t, tDist] = clusterTestMaris(nullMatrix,testMatrix,t_thr)
0004 %   Inputs:
0005 %      nullMatrix = a x b x iterations, where a and b are usually (frequency,
0006 %      time), (time, electrode), (frequency, frequency), etc. Iterations is
0007 %      the number of shuffled data analyzed. We expect nullMatrix to be
0008 %      t-values from shuffled data.
0009 %      testMatrix = a x b. The test matrix that will be tested against null
0010 %      hypothesis
0011 %      t_thr = threhold for t-value. If the t-value is above t_thr, then that
0012 %      data point will be included in the cluster.
0013 %   Outputs:
0014 %       cluster_loc
0015 %       cluster_p
0016 %       cluster_t
0017 %       tDist
0018 %
0019 %   Modification of Maris "Nonparametric statistical testing of EEG- and
0020 %   MEG-data." J Neurosci Methods (2007)
0021 %   The modification is that all null t-statistics are considered instead
0022 %   of the highest value. An important point to make is that the p-values
0023 %   are now subject to multiple-comparisons, so holm-bonferroni test should
0024 %   be done on the p-value outputs.
0025 
0026 % initialize
0027 iterations = size(nullMatrix,3);
0028 tDist = [];
0029 
0030 % make null-hypothesis cluster statistic distribution
0031 for iter = 1:iterations
0032     % get the data
0033     null_t = squeeze(nullMatrix(:,:,iter));
0034     
0035     % make clusters
0036     [null_cluster_stat,~] = mouse.stat.clusterStatistic(null_t,tThrMatrix);
0037     tDist = [tDist null_cluster_stat];
0038 end
0039 % find whether clusters of original data' p-value and t-value
0040 
0041 
0042 % time to test!
0043 % make clusters
0044 t = testMatrix;
0045 [cluster_t,cluster_loc] = mouse.stat.clusterStatistic(t,tThrMatrix);
0046 cluster_p = nan(1,numel(cluster_t));
0047 for i=1:numel(cluster_t)
0048     cluster_p(i) = (sum(tDist>=abs(cluster_t(i)))+1)./(numel(tDist)+1); % where is the cluster statistic in the distribution
0049 end
0050 significant = holmBonf(cluster_p);
0051 end
0052

Generated on Fri 28-Dec-2018 21:42:50 by m2html © 2005