<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi David,<div class=""><br class=""></div><div class="">ages ago I wrote a stat_fun for this to be used specifically for a project.</div><div class="">Here’s the code, maybe it still works and does what you want to do.</div><div class="">Basically, you run the ww-test, and then feed the stat-field back to the montecarlo statistics function.</div><div class=""><br class=""></div><div class="">%%</div><div class=""><div class="">function [s] = statfun_wwtest(cfg, dat, design)</div><div class=""><br class=""></div><div class="">selA = find(design(cfg.ivar,:)==1); % selecton condition 1 or A</div><div class="">selB = find(design(cfg.ivar,:)==2); % selecton condition 2 or B</div><div class="">dfA  = length(selA);</div><div class="">dfB  = length(selB);</div><div class=""><br class=""></div><div class="">if (dfA+dfB)<size(design, 2)</div><div class="">  % there are apparently replications that belong neither to condition 1, nor to condition 2</div><div class="">  warning('inappropriate design, it should only contain 1''s and 2''s');</div><div class="">end</div><div class="">   </div><div class="">    for comp=1:length(dat)</div><div class="">        [pval table] = circ_wwtest(dat(comp,selA),dat(comp,selB));</div><div class="">    </div><div class="">        prob(comp,1)=pval;</div><div class="">        stat(comp,1)=table{2,5};</div><div class="">    % the stat field is used in STATISTICS_MONTECARLO to make the</div><div class="">    % randomization distribution, but you can also return other fields</div><div class="">    % which will be passed on to the command line in the end.</div><div class="">    end</div><div class="">s.stat = stat;</div><div class="">s.prob = prob;</div><div>%%</div><div><br class=""></div><div>Hope this helps,</div><div><br class=""></div><div>Julian</div><div><br class=""><blockquote type="cite" class=""><div class="">Am 18.05.2022 um 00:55 schrieb David Marcel Baum via fieldtrip <<a href="mailto:fieldtrip@science.ru.nl" class="">fieldtrip@science.ru.nl</a>>:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_default" style="font-family:arial,sans-serif;font-size:small">Hello Everyone,<br class=""><br class="">I am attempting to use Fieldtrip's cluster-based permutation statistics on phase estimates (circular values). Thus I cannot use the statistic functions provided by Fieldtrip (e.g., "ft_statfun_depsamplesT.m"). I would like to integrate the circstat toolbox into Fieldtrip instead. Could someone help me validate that the following approach is correct:<br class=""><br class="">Create a ft_statfun_[NewName].m that does:<br class="">1. For each sample (here: channel), calculate the F value using the circstat function circ_wwtest.m<br class="">2. Get the critical F value using "finv"<br class=""><br class="">Would be happy and grateful about any input!<br class="">Regards<br class="">David<br class="">--<br class="">David Marcel BAUM<br class=""><br class="">Instituto de Ingeniería Biológica y Médica<br class="">Pontificia Universidad Católica de Chile<br class="">Santiago, Chile<br class=""></div></div>
_______________________________________________<br class="">fieldtrip mailing list<br class=""><a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br class="">https://doi.org/10.1371/journal.pcbi.1002202<br class=""></div></blockquote></div><br class=""></div></body></html>