<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Mangal, "Nirmala UI", "Devanagari Sangam MN", sans-serif; font-size: 11pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<b style="font-weight:normal">
<p dir="ltr" style="line-height:1.3090909090909089;margin-top:12pt;margin-bottom:0pt">
<span style="font-size:12pt;font-family:'Times New Roman';color:#000000;background-color:#ffffff;font-weight:400" class="ContentPasted0">Dear Stephan,</span></p>
<p dir="ltr" style="line-height:1.2;margin-top:12pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:'Times New Roman';color:#000000;background-color:#ffffff;font-weight:400" class="ContentPasted0">Thank you for your response, but in this case our
 source analysis data does not contain the average across subjects. If you refer to the ‘avg’ structure, it is one of the outputs coming from performing the source analysis by contrasting the pre and post stimulus interval. During the process, I calculate an
 inverse filter calculated from both intervals together and then applied separately to each interval, from this process I obtain the output ‘avg’, I do this for each subject and each condition.</span></p>
<p dir="ltr" style="line-height:1.2;margin-top:12pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:'Times New Roman';color:#000000;background-color:#ffffff;font-weight:400" class="ContentPasted0">You can see it in more detail at this link</span><a href="https://www.fieldtriptoolbox.org/tutorial/beamformer/" class="ContentPasted0"><span style="font-size:12pt;font-family:'Times New Roman';color:#000000;background-color:#ffffff;font-weight:400"> </span><span style="font-size:12pt;font-family:'Times New Roman';color:#000080;background-color:#ffffff;font-weight:400;text-decoration:underline;text-decoration-skip-ink:none">https://www.fieldtriptoolbox.org/tutorial/beamformer/</span></a><span style="font-size:12pt;font-family:'Times New Roman';color:#000000;background-color:#ffffff;font-weight:400" class="ContentPasted0"> in
 the section </span><span style="font-size:12pt;font-family:'Times New Roman';color:#000000;background-color:#ffffff;font-weight:400;font-style:italic" class="ContentPasted0">‘Source Analysis: Contrasting activity to another interval’.</span></p>
<p dir="ltr" style="line-height:1.2;margin-top:12pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:'Times New Roman';color:#000000;background-color:#ffffff;font-weight:400" class="ContentPasted0">Our source data are distributed as follows, for each
 subject I have the mean power of each voxel for each condition independently, perhaps best understood with the following image:</span><a href="https://gyazo.com/00af9e5ca9647bec71d561c4197eefc5" class="ContentPasted0"><span style="font-size:12pt;font-family:'Times New Roman';color:#000000;background-color:#ffffff;font-weight:400"> </span></a><a href="https://gyazo.com/39bb9c919f469d95f984a68b6dca6e18" class="ContentPasted0"><span style="font-size:12pt;font-family:'Times New Roman';color:#1155cc;background-color:#ffffff;font-weight:400;text-decoration:underline;text-decoration-skip-ink:none">https://gyazo.com/39bb9c919f469d95f984a68b6dca6e18</span></a><span style="font-size:12pt;font-family:'Times New Roman';color:#000000;background-color:#ffffff;font-weight:400" class="ContentPasted0"> </span></p>
<br class="ContentPasted0">
<span style="border:none;display:inline-block;overflow:hidden;width:704px;height:348px"><img width="704" height="348" style="margin-top:0px" class="ContentPasted0" src="https://lh6.googleusercontent.com/fLsaCgJYAhYIaQRGNxzNEdwzQN7n10QBbjS-oOeTbhvP68qQ3rBW8dnFa37-Vg2pzaNbY2NiVPCW4YCNLwwed-IpPQfXo-RzL1Sh9ac7LgqEkClX4kIr79C_BAfOvGhmtIMeW-wgY5VYJ31TSbyQpcllTBTnD13S5roabFDKvjtghYDMV7sr-2Kz1Hanbg"></span>
<p dir="ltr" style="line-height:1.3090909090909089;margin-top:0pt;margin-bottom:0pt">
<span style="font-size:12pt;font-family:'Times New Roman';color:#000000;background-color:#ffffff;font-weight:400" class="ContentPasted0">We suspect that the problem could stem from the fact that our data structure differs from the one described in the tutorial
 for ft_sourcestatistics in that we do not provide sources from each trail, but the average source of each condition instead. So, our question is whether with this data structure we can perform a nonparametric randomization test, by creating the null hypothesis
 distribution shuffling voxels between conditions and then obtain an 'average' null distribution across subjects. I am not sure if this makes sense. Another way could be to shuffle conditions across subjects and obtain a null hypothesis distribution from this
 shuffle.</span></p>
<br class="ContentPasted0">
<p dir="ltr" style="line-height:1.3090909090909089;margin-top:12pt;margin-bottom:0pt">
<span style="font-size:12pt;font-family:'Times New Roman';color:#000000;background-color:#ffffff;font-weight:400" class="ContentPasted0">Thank you again,</span></p>
<p dir="ltr" style="line-height:1.3090909090909089;margin-top:12pt;margin-bottom:0pt">
<span style="font-size:12pt;font-family:'Times New Roman';color:#000000;background-color:#ffffff;font-weight:400" class="ContentPasted0">Best,</span></p>
<p dir="ltr" style="line-height:1.3090909090909089;margin-top:12pt;margin-bottom:0pt">
<span style="font-size:12pt;font-family:'Times New Roman';color:#000000;background-color:#ffffff;font-weight:400" class="ContentPasted0">Francisco Javier Gómez</span></p>
<p dir="ltr" style="line-height:1.3090909090909089;margin-top:12pt;margin-bottom:0pt">
<span style="font-size:12pt;font-family:'Times New Roman';color:#000000;background-color:#ffffff;font-weight:400" class="ContentPasted0">Instituto de Biomedicina de Sevilla(IBIS)</span></p>
</b><br class="Apple-interchange-newline ContentPasted0">
<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>De:</b> STEPHAN MORATTI <smoratti@psi.ucm.es><br>
<b>Enviado:</b> jueves, 17 de noviembre de 2022 14:44<br>
<b>Para:</b> FieldTrip discussion list <fieldtrip@science.ru.nl><br>
<b>Cc:</b> FRANCISCO JAVIER GÓMEZ CAMPOS <fjgomez-ibis@us.es><br>
<b>Asunto:</b> Re: [FieldTrip] Help with ft_sourcestatistics</font>
<div> </div>
</div>
<div>
<div dir="ltr">Dear Francisco,
<div><br>
</div>
<div>It seems that in your source data you probably have the average across subjects, but the individual source data for each subject is missing. You may store them in individual cells and then submit these cells to the source statistics.</div>
<div><br>
</div>
<div>Best,</div>
<div><br>
</div>
<div>Stephan</div>
<div><br>
</div>
</div>
<br>
<div class="x_gmail_quote">
<div dir="ltr" class="x_gmail_attr">El jue, 17 nov 2022 a las 11:32, FRANCISCO JAVIER GÓMEZ CAMPOS via fieldtrip (<<a href="mailto:fieldtrip@science.ru.nl">fieldtrip@science.ru.nl</a>>) escribió:<br>
</div>
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left-width:1px; border-left-style:solid; border-left-color:rgb(204,204,204); padding-left:1ex">
<div class="x_msg-3175404277216859868">
<div dir="ltr">
<div style="font-family:Mangal,"Nirmala UI","Devanagari Sangam MN",sans-serif; font-size:11pt; color:rgb(0,0,0); background-color:rgb(255,255,255)">
Dear community,<br>
</div>
<div style="font-family:Mangal,"Nirmala UI","Devanagari Sangam MN",sans-serif; font-size:11pt; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Mangal,"Nirmala UI","Devanagari Sangam MN",sans-serif; font-size:11pt; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<div>I am having problems using the ft_sourcestatistics function. I would like to use this function</div>
<div>to conduct a within-subject analysis to establish which areas show differences between two</div>
<div>experimental conditions. I mainly have doubts about two aspects, the first one is about how to</div>
<div>attach the source analysis data, and the second one is about the design of the design matrix.</div>
<div><br>
</div>
<div>Regarding the data coming from the source analysis, I have the sources separated by</div>
<div>conditions (obtained by following this tutorial <a href="https://www.fieldtriptoolbox.org/tutorial/beamformer/" target="_blank">
https://www.fieldtriptoolbox.org/tutorial/beamformer/</a>):</div>
<div><br>
</div>
<div>Source analysis data for each condition:</div>
<blockquote style="margin-top:0px; margin-bottom:0px">
<div>freq: 4.8302</div>
<div>cfg: [1×1 struct]</div>
<div>dim: [85 110 132]</div>
<div>inside: [1234200×1 logical]</div>
<div>pos: [1234200×3 double]</div>
<div>method: &#39;average&#39;</div>
<div>avg: [1×1 struct]</div>
</blockquote>
<blockquote style="margin-top:0px; margin-bottom:0px">
<div><br>
</div>
<div>avg:</div>
<blockquote style="margin-top:0px; margin-bottom:0px">
<div>pow: [1234200×1 double]</div>
<div>noise: [1234200×1 double]</div>
<div>filter: {1234200×1 cell}</div>
<div>label: {61×1 cell}</div>
<div>filterdimord: &#39;{pos}_ori_chan&#39;</div>
</blockquote>
</blockquote>
<div><br>
</div>
<div>The code I use is the following (based on this code in this tutorial</div>
<div><a href="https://www.fieldtriptoolbox.org/example/source_statistics/" target="_blank">https://www.fieldtriptoolbox.org/example/source_statistics/</a> ) :</div>
<div><br>
</div>
<blockquote style="margin-top:0px; margin-bottom:0px">
<div>design=[1 2]; %for 2 conditions</div>
<div>% run sourcestatistics using cluster based correction %</div>
<div>cfg = [];</div>
<div>cfg.dim = sourceanalysis_condition1(1).dim;</div>
<div><br>
</div>
<div>cfg.method = &#39;montecarlo&#39;;</div>
<div>cfg.statistic = &#39;ft_statfun_depsamplesT&#39;;</div>
<div>cfg.parameter = &#39;pow&#39;;</div>
<div>cfg.correctm = &#39;cluster&#39;;</div>
<div>cfg.numrandomization = &#39;all&#39;;</div>
<div>cfg.alpha = 0.05; % note that this only implies single-sided testing</div>
<div>cfg.tail = 0;</div>
<div>cfg.design(1,:) = [1:length(find(design==1)) 1:length(find(design==2))];</div>
<div>cfg.design(2,:) = design;</div>
<div>cfg.uvar = 1; % row of design matrix that contains unit variable (in this case: trials)</div>
<div>cfg.ivar = 2; % row of design matrix that contains independent variable (the conditions)</div>
<div>stat = ft_sourcestatistics(cfg, sourceanalysis_condition1, sourceanalysis_condition2)</div>
</blockquote>
<div><br>
</div>
<div>When I run this code, I get the following error:</div>
<blockquote style="margin-top:0px; margin-bottom:0px">
<div>Error using ft_statfun_depsamplesT (line 83)</div>
<div>The data must contain at least two units of observation (trials or subjects).</div>
</blockquote>
<div><br>
</div>
<div>I understand that my design matrix and/or the structure of sourceanalysis_condition are</div>
<div>wrong, I have tried different combinations and I cannot find the solution. I hope you can</div>
<div>guide me in this regard so that I can adapt it to the conditions of my study.</div>
<div><br>
</div>
<div>Thanks,</div>
<div>Francisco Javier Gómez,</div>
Instituto de Biomedicina de Sevilla (IBIS)<br>
</div>
</div>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<a href="https://doi.org/10.1371/journal.pcbi.1002202" rel="noreferrer" target="_blank">https://doi.org/10.1371/journal.pcbi.1002202</a><br>
</div>
</blockquote>
</div>
<br clear="all">
<div><br>
</div>
-- <br>
<div dir="ltr" class="x_gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div><br>
<font face="monospace, monospace">Stephan Moratti, PhD</font></div>
<div><font face="monospace, monospace">Profesor de Psicología Experimental</font></div>
<div><font face="monospace, monospace">Departamento de Psicología Experimental</font></div>
<div><font face="monospace, monospace">Facultad de Psicología</font></div>
<div><font face="monospace, monospace">Center for Cognitive and Computational Neuroscience</font></div>
<div><font face="monospace, monospace">Universidad Complutense de Madrid</font></div>
<div><font face="monospace, monospace"><a href="mailto:smoratti@ucm.es" target="_blank">smoratti@ucm.es</a></font></div>
<div><br>
<img src="http://www.ucm.es/logo/ucm.png"><br>
</div>
<div dir="ltr"><br>
<div dir="ltr">La información contenida en este correo es CONFIDENCIAL, de uso exclusivo del destinatario/a arriba mencionado. Si ha recibido este mensaje por error, notifíquelo inmediatamente por esta misma vía y proceda a su eliminación, ya que ud. tiene
 totalmente prohibida cualquier utilización del mismo, en virtud de la legislación vigente.</div>
<div dir="ltr"><br>
</div>
<div dir="ltr">Los datos personales recogidos serán incorporados en la actividad de tratamiento 'Correoweb', bajo la titularidad del Vicerrectorado de Tecnologías de la Información, y en él el interesado/a podrá ejercer los derechos de acceso, rectificación,
 supresión u oposición ante el mismo (artículos 15-21 del Reglamento UE 2016/679 de 27 de abril de 2016).</div>
<div dir="ltr"><br>
</div>
<div dir="ltr"><img src="http://www.ucm.es/logo/ambiente.png"><span style="background-color:rgb(106,168,79)"> Antes de imprimir este correo piense si es necesario: el medio ambiente es cosa de todos.</span></div>
<div dir="ltr"><br>
</div>
<div dir="ltr">This message is private and confidential and it is intended exclusively for the addressee. If you receive this message by mistake, you should not disseminate, distribute or copy this e-mail. Please inform the sender and delete the message and
 attachments from your system, as it is completely forbidden for you to use this information, according to the current legislation. No confidentiality nor any privilege regarding the information is waived or lost by any mistransmission or malfunction.</div>
<div dir="ltr"><br>
</div>
<div dir="ltr">The personal data herein will be collected in the file "Correoweb", under the ownership of the Vice-Rectorate for Information Technologies, in which those interested may exercise their right to access, rectify, erasure or right to object the
 contents (article 15-21 of Regulation (EU) 2016/679, General Data Protection Regulation).</div>
<div dir="ltr"><br>
</div>
<div dir="ltr"><img src="http://www.ucm.es/logo/ambiente.png"> <span style="background-color:rgb(106,168,79)">Before printing this mail please consider whether it is really necessary: the environment is a concern for us all.</span></div>
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>