Back to the main page.

Bug 2049 - ft_statistics_montecarlo: implement confidence intervals for p-value

Status CLOSED FIXED
Reported 2013-03-13 13:45:00 +0100
Modified 2014-03-12 12:21:39 +0100
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P3 normal
Assigned to: Jörn M. Horschig
URL:
Tags:
Depends on:
Blocks:
See also:

Jan-Mathijs Schoffelen - 2013-03-13 13:45:20 +0100

Implement it and store the result in two separate fields: lower bound and upper bound, e.g. stat.probupperbound = xxx stat.prbmclownbnd = yyy


Jan-Mathijs Schoffelen - 2013-03-13 13:48:30 +0100

stat.montecarlo stat.montecarhi


Jörn M. Horschig - 2013-03-20 11:44:09 +0100

hmm humm, ehm... if isfield(stat, 'posclusters') for i=1:length(stat.posclusters) stat.posclusters(i).var = Nrand*stat.posclusters(i).prob.*(1-stat.posclusters(i).prob); stat.posclusters(i).cirange = 1.96.*sqrt(stat.posclusters(i).var./Nrand); if stat.posclusters(i).prob<cfg.alpha && stat.posclusters(i).prob+stat.posclusters(i).cirange>=cfg.alpha warning('FieldTrip:posCluster_exceeds_alpha', sprintf('The p-value of positive cluster #%i is below %.3f but the confidence interval is above - consider increasing the number of permutations!', i, cfg.alpha)); end end end if isfield(stat, 'negclusters') for i=1:length(stat.negclusters) stat.negclusters(i).var = Nrand*stat.negclusters(i).prob.*(1-stat.negclusters(i).prob); stat.negclusters(i).cirange = 1.96.*sqrt(stat.negclusters(i).var./Nrand); if stat.negclusters(i).prob<cfg.alpha && stat.negclusters(i).prob+stat.negclusters(i).cirange>=cfg.alpha warning('FieldTrip:negCluster_exceeds_alpha', sprintf('The p-value of negative cluster #%i is below %.3f but the confidence interval is above - consider increasing the number of permutations!', i, cfg.alpha)); end end end hm?


Jörn M. Horschig - 2013-03-20 11:51:59 +0100

or rather a warning_once and be less specific about which cluster the niffy one is?


Jörn M. Horschig - 2013-03-20 11:53:39 +0100

tutorial data: Warning: The p-value of positive cluster #1 is below 0.025 but the confidence interval is above - consider increasing the number of permutations! > In ft_statistics_montecarlo at 396 In trunk\private\statistics_wrapper at 298 In ft_timelockstatistics at 111 In test_tutorial_clusterpermutationtimelock at 297


Jörn M. Horschig - 2013-03-20 11:55:24 +0100

last spammail: should the cirange field be there only for stat.posclusters and stat.negclusters or for stat.prob as well?


Jörn M. Horschig - 2013-03-20 14:03:25 +0100

Jm or Robert, before committing, is this correct? stddev = sqrt(stat.prob.*(1-stat.prob)); stat.cirange = 1.96*stddev/sqrt(Nrand);


Robert Oostenveld - 2013-03-22 11:29:32 +0100

(In reply to comment #6) I have no idea from the top of the head. I suggest to check with Eric (now CC)


Jörn M. Horschig - 2013-03-22 11:32:30 +0100

Eric, could you please check my last comment to verify that what I did is correct?


Jörn M. Horschig - 2013-03-25 17:12:32 +0100

Thanks Eric, we met this noon and he 'unconfused' my confusion: var(p) = var(X/n) = p*(1-p)/n, and p ± 1.96(sqrt(var(p)) svn ci ft_statistics_montecarlo.m -m "enhancement #2049 - monte carlo confidence interval added, warning is thrown when p<alpha and CI includes alpha" Sending ft_statistics_montecarlo.m Transmitting file data . Committed revision 7702.