<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<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 ContentPasted0">
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);" class="elementToProof ContentPasted0">
<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);" class="elementToProof ContentPasted0">
<div class="ContentPasted0">I am having problems using the ft_sourcestatistics function. I would like to use this function</div>
<div class="ContentPasted0">to conduct a within-subject analysis to establish which areas show differences between two</div>
<div class="ContentPasted0">experimental conditions. I mainly have doubts about two aspects, the first one is about how to</div>
<div class="ContentPasted0">attach the source analysis data, and the second one is about the design of the design matrix.</div>
<div class="ContentPasted0"><br>
</div>
<div class="ContentPasted0">Regarding the data coming from the source analysis, I have the sources separated by</div>
<div class="ContentPasted0">conditions (obtained by following this tutorial https://www.fieldtriptoolbox.org/tutorial/beamformer/):</div>
<div class="ContentPasted0"><br>
</div>
<div class="ContentPasted0">Source analysis data for each condition:</div>
<blockquote style="margin-top:0;margin-bottom:0">
<div class="ContentPasted0">freq: 4.8302</div>
<div class="ContentPasted0">cfg: [1×1 struct]</div>
<div class="ContentPasted0">dim: [85 110 132]</div>
<div class="ContentPasted0">inside: [1234200×1 logical]</div>
<div class="ContentPasted0">pos: [1234200×3 double]</div>
<div class="ContentPasted0">method: &#39;average&#39;</div>
<div class="ContentPasted0">avg: [1×1 struct]</div>
</blockquote>
<blockquote style="margin-top:0;margin-bottom:0">
<div class="ContentPasted0"><br>
</div>
<div class="ContentPasted0">avg:</div>
<blockquote style="margin-top:0;margin-bottom:0">
<div class="ContentPasted0">pow: [1234200×1 double]</div>
<div class="ContentPasted0">noise: [1234200×1 double]</div>
<div class="ContentPasted0">filter: {1234200×1 cell}</div>
<div class="ContentPasted0">label: {61×1 cell}</div>
<div class="ContentPasted0">filterdimord: &#39;{pos}_ori_chan&#39;</div>
</blockquote>
</blockquote>
<div><br class="ContentPasted0">
</div>
<div class="ContentPasted0">The code I use is the following (based on this code in this tutorial</div>
<div class="ContentPasted0">https://www.fieldtriptoolbox.org/example/source_statistics/ ) :</div>
<div class="ContentPasted0"><br>
</div>
<blockquote style="margin-top:0;margin-bottom:0">
<div class="ContentPasted0">design=[1 2]; %for 2 conditions</div>
<div class="ContentPasted0">% run sourcestatistics using cluster based correction %</div>
<div class="ContentPasted0">cfg = [];</div>
<div class="ContentPasted0">cfg.dim = sourceanalysis_condition1(1).dim;</div>
<div><br class="ContentPasted0">
</div>
<div class="ContentPasted0">cfg.method = &#39;montecarlo&#39;;</div>
<div class="ContentPasted0">cfg.statistic = &#39;ft_statfun_depsamplesT&#39;;</div>
<div class="ContentPasted0">cfg.parameter = &#39;pow&#39;;</div>
<div class="ContentPasted0">cfg.correctm = &#39;cluster&#39;;</div>
<div class="ContentPasted0">cfg.numrandomization = &#39;all&#39;;</div>
<div class="ContentPasted0">cfg.alpha = 0.05; % note that this only implies single-sided testing</div>
<div class="ContentPasted0">cfg.tail = 0;</div>
<div class="ContentPasted0">cfg.design(1,:) = [1:length(find(design==1)) 1:length(find(design==2))];</div>
<div class="ContentPasted0">cfg.design(2,:) = design;</div>
<div class="ContentPasted0">cfg.uvar = 1; % row of design matrix that contains unit variable (in this case: trials)</div>
<div class="ContentPasted0">cfg.ivar = 2; % row of design matrix that contains independent variable (the conditions)</div>
<div class="ContentPasted0">stat = ft_sourcestatistics(cfg, sourceanalysis_condition1, sourceanalysis_condition2)</div>
</blockquote>
<div><br class="ContentPasted0">
</div>
<div class="ContentPasted0">When I run this code, I get the following error:</div>
<blockquote style="margin-top:0;margin-bottom:0">
<div class="ContentPasted0">Error using ft_statfun_depsamplesT (line 83)</div>
<div class="ContentPasted0">The data must contain at least two units of observation (trials or subjects).</div>
</blockquote>
<div><br class="ContentPasted0">
</div>
<div class="ContentPasted0">I understand that my design matrix and/or the structure of sourceanalysis_condition are</div>
<div class="ContentPasted0">wrong, I have tried different combinations and I cannot find the solution. I hope you can</div>
<div class="ContentPasted0">guide me in this regard so that I can adapt it to the conditions of my study.</div>
<div><br class="ContentPasted0">
</div>
<div class="ContentPasted0">Thanks,</div>
<div class="ContentPasted0">Francisco Javier Gómez,</div>
Instituto de Biomedicina de Sevilla (IBIS)<br>
</div>
</body>
</html>