<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">Hi Mats,</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">Check out the option <span style="font-family:arial,sans-serif;font-weight:bold;color:rgb(106,106,106);line-height:18.2px">cfg</span><span style="font-family:arial,sans-serif;color:rgb(84,84,84);line-height:18.2px">.</span><span style="font-family:arial,sans-serif;font-weight:bold;color:rgb(106,106,106);line-height:18.2px">rawtrial</span><span style="font-family:arial,sans-serif;color:rgb(84,84,84);line-height:18.2px">='yes'</span></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><span style="font-family:arial,sans-serif;color:rgb(84,84,84);line-height:18.2px"><br></span></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><span style="font-family:arial,sans-serif;color:rgb(84,84,84);line-height:18.2px">Lorenzo</span></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><p style="margin:0cm 0cm 0.0001pt"><font size="1" face="arial, helvetica, sans-serif"><br></font></p><p style="margin:0cm 0cm 0.0001pt"><font size="1" face="arial, helvetica, sans-serif"><br></font></p><p style="margin:0cm 0cm 0.0001pt"><font size="1" face="arial, helvetica, sans-serif">Lorenzo Magazzini</font></p><p style="margin:0cm 0cm 0.0001pt"><font size="1" face="arial, helvetica, sans-serif">PhD Student</font></p><p style="margin:0cm 0cm 0.0001pt"><font size="1" face="arial, helvetica, sans-serif"><a href="mailto:magazzinil@cardiff.ac.uk" target="_blank">magazzinil@cardiff.ac.uk</a></font></p><p style="margin:0cm 0cm 0.0001pt"><font size="1" face="arial, helvetica, sans-serif"><br></font></p><p style="margin:0cm 0cm 0.0001pt"><font size="1" face="arial, helvetica, sans-serif">CUBRIC Building<br>Maindy Road<u></u><u></u></font></p><p style="margin:0cm 0cm 0.0001pt"><font size="1" face="arial, helvetica, sans-serif">Cardiff<br>CF24 4HQ</font></p><p style="margin:0cm 0cm 0.0001pt"><font face="verdana, sans-serif" size="1"><br></font></p></div></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On 27 July 2016 at 16:04, Es, M.W.J. van (Mats) <span dir="ltr"><<a href="mailto:M.vanEs@donders.ru.nl" target="_blank">M.vanEs@donders.ru.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">Hi FieldTrippers,
<div><br>
</div>
<div>I am currently trying to do source analysis on an individual subject (using the fieldtrip tutorial as a guideline). I have baseline (*Bl) and activity (*Act) data. I constructed a common filter (using DICS) and added the filter to the cfg structure before
doing sourceanalysis on the individual CSD's of the active and baseline data, respectively. Although I tried specifying cfg.keeptrials = 'yes' in every step, the output of ft_sourceanalysis is an average over trials:</div>
<div><br>
</div>
<div>
<div>sourceAct = </div>
<div><br>
</div>
<div> freq: 11</div>
<div> inside: [2004x1 logical]</div>
<div> pos: [2004x3 double]</div>
<div> method: 'average'</div>
<div> avg: [1x1 struct]</div>
<div> cfg: [1x1 struct]</div>
</div>
<div><br>
</div>
<div>This (I think) causes errors when I subsequently try to do sourcestatistics:</div>
<div><br>
</div>
<div>
<div>Error using ft_statistics_montecarlo (line 242)</div>
<div>could not determine the parametric critical value for clustering</div>
<div><br>
</div>
<div>Error in ft_sourcestatistics (line 205)</div>
<div> [stat, cfg] = statmethod(cfg, dat, design);</div>
</div>
<div><br>
</div>
<div>Can anybody tell me what I'm doing wrong/how to do source statistics on an individual subject? <span style="font-size:10pt">You can find my code below. Thank you!</span></div>
<div><span style="font-size:10pt">Mats</span></div>
<div><br>
</div>
<div><br>
</div>
<div><i>% calculate individual CSD</i></div>
<div>
<div><i>cfg = [];</i></div>
<div><i>cfg.method = 'mtmfft';</i></div>
<div><i>cfg.output = 'powandcsd';</i></div>
<div><i>cfg.tapsmofrq = 3;</i></div>
<div><i>cfg.foilim = [11 11];</i></div>
<div><i>% cfg.keeptrials = 'yes';</i></div>
<div><i>freqAct = ft_freqanalysis(cfg, dataAct);</i></div>
<div><i>freqBl = ft_freqanalysis(cfg, dataBl);</i></div>
</div>
<div><br>
</div>
<div><br>
</div>
<div><i>% compute common filter</i></div>
<div>
<div><i>dataAll = ft_appenddata([], dataAct, dataBl);</i></div>
<div><i>cfg=[];</i></div>
<div><i>cfg.method = 'mtmfft';</i></div>
<div><i>cfg.output = 'powandcsd';</i></div>
<div><i>cfg.tapsmofrq = 3;</i></div>
<div><i>cfg. foilim = [11 11];</i></div>
<div><i>freqAll = ft_freqanalysis(cfg, dataAll);</i></div>
</div>
<div><i><br>
</i></div>
<div><i>
<div>cfg = [];</div>
<div>cfg.method = 'dics';</div>
<div>cfg.frequency = 11;</div>
<div>cfg.grid = grid; % caculated beforehand</div>
<div>cfg.headmodel = headmodel; <i style="font-size:13.3333px">% caculated beforehand</i></div>
</i><i>
<div>cfg.dics.projectnoise = 'yes';</div>
<div>cfg.dics.lambda = '5%';</div>
<div>cfg.dics.keepfilter = 'yes';</div>
<div>cfg.dics.realfilter = 'yes';</div>
<div>sourceAll = ft_sourceanalysis(cfg, freqAll);</div>
<div><br>
</div>
<div><br>
</div>
<div>% source analysis</div>
<div>
<div>cfg.grid.filter = sourceAll.avg.filter;</div>
<div>cfg.dics.fixedori = 'yes';</div>
<div>cfg.keeptrials = 'yes';</div>
<div>sourceAct = ft_sourceanalysis(cfg, freqAct);</div>
<div>sourceBl = ft_sourceanalysis(cfg, freqBl);</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>% source statistics</div>
<div>
<div>cfg = [];</div>
<div>cfg.method = 'montecarlo';</div>
<div>cfg.statistic = 'ft_statfun_depsamplesT';</div>
<div>cfg.parameter = 'avg.pow';</div>
<div>cfg.correctm = 'cluster';</div>
<div>cfg.clusteralpha = 0.05;</div>
<div><i style="font-size:10pt">
<div style="display:inline!important">
<div style="display:inline!important">cfg.clusterstatistic = 'maxsum';</div>
</div>
</i></div>
<div>cfg.numrandomization = 1000;</div>
<div>cfg.alpha = 0.05; % note that this only implies single-sided testing</div>
<div>cfg.tail = 0;</div>
<div>cfg.clustertail = 0;</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>design = [1:nTrials, 1:nTrials; ones(1, nTrials), 2*ones(1,nTrials)]';</div>
<div>cfg.design = design';</div>
<div><br>
</div>
<div>stat = ft_sourcestatistics(cfg, sourceAct, sourceBl);</div>
</div>
<div><br>
</div>
</i></div>
<div><br>
</div>
</div>
</div>
<br>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><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></blockquote></div><br></div>