{"id":517,"date":"2024-01-29T10:35:57","date_gmt":"2024-01-29T08:35:57","guid":{"rendered":"https:\/\/benediktehinger.de\/blog\/science\/?p=517"},"modified":"2024-01-29T10:38:40","modified_gmt":"2024-01-29T08:38:40","slug":"on-the-onsets-of-clusters-a-replication-of-rousselet-2023","status":"publish","type":"post","link":"https:\/\/benediktehinger.de\/blog\/science\/on-the-onsets-of-clusters-a-replication-of-rousselet-2023\/","title":{"rendered":"On the onsets of clusters: A replication of Rousselet 2023 \/ adding ClusterDepth"},"content":{"rendered":"\n<p>I recently read this paper, <a href=\"https:\/\/doi.org\/10.1101\/2023.11.13.566864\">on the measurement of onsets of clusters in EEG data from Guillaume Rousselet<\/a> and later got asked to be a reviewer of the paper. The main point it raises is a different one to what I adress in the paper: Most people do not explicitly test for an onset, they fall victim to the interaction-fallacy. In principle, you need an explicit test, testing e.g. timepoint 100 vs. 150 to check whether the activity changed significantly.<\/p>\n\n\n\n<p>But because I recently implemented the <a href=\"https:\/\/doi.org\/10.1016\/j.neuroimage.2021.118824\">ClusterDepth <\/a>algorithm in <a href=\"https:\/\/github.com\/s-ccs\/ClusterDepth.jl\">Julia<\/a>, I thought it would be nice to add this to the papers algorithms to test onsets (and I thought it should do great).<\/p>\n\n\n\n<p>Let&#8217;s start with simulating data &#8211; I used our toolbox <a href=\"https:\/\/github.com\/unfoldtoolbox\/UnfoldSim.jl\">UnfoldSim.jl <\/a>which made simulation relatively easy<\/p>\n\n\n\n<div class=\"wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-ad2f72ca wp-block-group-is-layout-flex\">\n<figure class=\"wp-block-image size-large is-resized\"><a href=\"https:\/\/benediktehinger.de\/blog\/science\/upload\/sites\/2\/2024\/01\/grafik.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"736\" src=\"https:\/\/benediktehinger.de\/blog\/science\/upload\/sites\/2\/2024\/01\/grafik-1024x736.png\" alt=\"\" class=\"wp-image-518\" style=\"width:409px;height:auto\" srcset=\"https:\/\/benediktehinger.de\/blog\/science\/upload\/sites\/2\/2024\/01\/grafik-1024x736.png 1024w, https:\/\/benediktehinger.de\/blog\/science\/upload\/sites\/2\/2024\/01\/grafik-300x216.png 300w, https:\/\/benediktehinger.de\/blog\/science\/upload\/sites\/2\/2024\/01\/grafik-768x552.png 768w, https:\/\/benediktehinger.de\/blog\/science\/upload\/sites\/2\/2024\/01\/grafik.png 1212w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Theirs<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><a href=\"https:\/\/benediktehinger.de\/blog\/science\/upload\/sites\/2\/2024\/01\/grafik-2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"659\" height=\"971\" src=\"https:\/\/benediktehinger.de\/blog\/science\/upload\/sites\/2\/2024\/01\/grafik-2.png\" alt=\"\" class=\"wp-image-520\" style=\"width:218px;height:auto\" srcset=\"https:\/\/benediktehinger.de\/blog\/science\/upload\/sites\/2\/2024\/01\/grafik-2.png 659w, https:\/\/benediktehinger.de\/blog\/science\/upload\/sites\/2\/2024\/01\/grafik-2-204x300.png 204w\" sizes=\"auto, (max-width: 659px) 100vw, 659px\" \/><\/a><figcaption class=\"wp-element-caption\">Mine<\/figcaption><\/figure>\n<\/div>\n\n\n\n<pre class=\"wp-block-code\"><code>design = SingleSubjectDesign(;conditions=Dict(:condA=>&#91;\"noise\",\"test\"])) |> x->RepeatDesign(x,50);\n\n\t\nsignal = LinearModelComponent(;\n        basis=basis_signal,\n        formula = @formula(0~1+condA),\n        \u03b2 = &#91;0,1]\n);\n\nnoise = PinkNoise(;noiselevel=1);\nsim(seed) = simulate(MersenneTwister(seed), design, signal, UniformOnset(1,1), noise; return_epoched=true);<\/code><\/pre>\n\n\n\n<p>Next, I ran clusterdepth a 100 times (the paper uses many more repetitions) using<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cls = clusterdepth(d,statFun=ttest,permFun = permute_fun,nperm=2000)\nonsettimes.clusterdepth&#91;k] = times&#91;findfirst(&lt;=(0.05),cls)]<\/code><\/pre>\n\n\n\n<p>And plotted everything<\/p>\n\n\n\n<div class=\"wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-ad2f72ca wp-block-group-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/benediktehinger.de\/blog\/science\/upload\/sites\/2\/2024\/01\/F3.large_.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"502\" src=\"https:\/\/benediktehinger.de\/blog\/science\/upload\/sites\/2\/2024\/01\/F3.large_-1024x502.jpg\" alt=\"\" class=\"wp-image-522\" srcset=\"https:\/\/benediktehinger.de\/blog\/science\/upload\/sites\/2\/2024\/01\/F3.large_-1024x502.jpg 1024w, https:\/\/benediktehinger.de\/blog\/science\/upload\/sites\/2\/2024\/01\/F3.large_-300x147.jpg 300w, https:\/\/benediktehinger.de\/blog\/science\/upload\/sites\/2\/2024\/01\/F3.large_-768x376.jpg 768w, https:\/\/benediktehinger.de\/blog\/science\/upload\/sites\/2\/2024\/01\/F3.large_.jpg 1280w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Theirs<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a href=\"https:\/\/benediktehinger.de\/blog\/science\/upload\/sites\/2\/2024\/01\/grafik-3.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"749\" src=\"https:\/\/benediktehinger.de\/blog\/science\/upload\/sites\/2\/2024\/01\/grafik-3-1024x749.png\" alt=\"\" class=\"wp-image-521\" style=\"width:352px;height:auto\" srcset=\"https:\/\/benediktehinger.de\/blog\/science\/upload\/sites\/2\/2024\/01\/grafik-3-1024x749.png 1024w, https:\/\/benediktehinger.de\/blog\/science\/upload\/sites\/2\/2024\/01\/grafik-3-300x219.png 300w, https:\/\/benediktehinger.de\/blog\/science\/upload\/sites\/2\/2024\/01\/grafik-3-768x562.png 768w, https:\/\/benediktehinger.de\/blog\/science\/upload\/sites\/2\/2024\/01\/grafik-3.png 1339w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Mine<\/figcaption><\/figure>\n<\/div>\n\n\n\n<p>As you can see, Cluster-sum is earliest, then FDR but with many false positives in the bsaaeline, and then maxT \/ clusterdepth.  My implementation contains clusterdepth, but I did not implement the change-point detection. I think the results very nicely replicate Rousselet 2023!<\/p>\n\n\n\n<p>I am surprised though, that the clusterdepth did not perform better, and I&#8217;m currently investigating why this is the case.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently read this paper, on the measurement of onsets of clusters in EEG data from Guillaume Rousselet and later got asked to be a reviewer of the paper. The main point it raises is a different one to what I adress in the paper: Most people do not explicitly test for an onset, they fall victim to the interaction-fallacy. In principle, you need an explicit test, testing e.g. timepoint 100 vs. 150 to check whether the activity changed significantly. But because I recently implemented the ClusterDepth algorithm in Julia, I thought it would be nice to add this to&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-517","post","type-post","status-publish","format-standard","hentry","category-blog"],"_links":{"self":[{"href":"https:\/\/benediktehinger.de\/blog\/science\/wp-json\/wp\/v2\/posts\/517","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/benediktehinger.de\/blog\/science\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/benediktehinger.de\/blog\/science\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/benediktehinger.de\/blog\/science\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/benediktehinger.de\/blog\/science\/wp-json\/wp\/v2\/comments?post=517"}],"version-history":[{"count":0,"href":"https:\/\/benediktehinger.de\/blog\/science\/wp-json\/wp\/v2\/posts\/517\/revisions"}],"wp:attachment":[{"href":"https:\/\/benediktehinger.de\/blog\/science\/wp-json\/wp\/v2\/media?parent=517"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/benediktehinger.de\/blog\/science\/wp-json\/wp\/v2\/categories?post=517"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/benediktehinger.de\/blog\/science\/wp-json\/wp\/v2\/tags?post=517"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}