<div>Dear Fieldtrippers,</div>
<div> </div>
<div>I am trying to learn beamforming using the tutorial. I am succesful in calculating, with my own data, the relative change between the stuimulus and the baseline condition (as shown in the tutorial).</div>
<div> </div>
<div>However, if I want to do statistic (ie., compare the baseline and stimulus condition) I would need a common filter (not in the tutorial). I found very useful the website where this step is explained (examples of matlab scripts section). </div>
<div> </div>
<div>I am however confused on how to perform stats at the source level. I get the 2 conditions separately and I wish to compare them and hopefully plot WHERE the difference is seen.</div>
<div> </div>
<div>Do you have any advice on how to do it (or where to look)?</div>
<div> </div>
<div>Here is my script and I am sure I am doing some silly mistake in the last (statistic part) since it gives the error: ??? Reference to non-existent field 'pow'. </div>
<div> </div>
<div><br clear="all">cfg = []; <br>cfg.toilim = [-0.5 0]; <br>dataPre = ft_redefinetrial(cfg, DataOut);</div>
<div> </div>
<div>cfg.toilim = [0.5 1]; <br>dataPost = ft_redefinetrial(cfg, DataOut);</div>
<div> </div>
<div>data = ft_appenddata([], dataPre, dataPost);<br>design = [ones(1, length(dataPre.trial)) ones(1, length(dataPost.trial))*2];</div>
<div> </div>
<div>cfg = [];<br>cfg.method = 'mtmfft'; </div>
<div>cfg.output = 'powandcsd';<br>cfg.taper = 'dpss';<br>cfg.keeptrials = 'yes';<br>cfg.keeptapers = 'no';<br>cfg.foi = 57:2:63;<br>cfg.tapsmofrq = ones(length(cfg.foi), 1).* 5;<br>
</div>
<div>freq = ft_freqanalysis(cfg, data);</div>
<div> </div>
<div> </div>
<div>cfg = []; <br>cfg.frequency = 60; <br>cfg.method = 'dics'; </div>
<div>cfg.grid = grid; <br>cfg.vol = vol;<br>cfg.grad = DataOut.hdr.grad;<br>cfg.keepfilter = 'yes';</div>
<div> </div>
<div>source = ft_sourceanalysis(cfg, freq);</div>
<div> </div>
<div> </div>
<div>cfg = []; <br>cfg.frequency = 60; <br>cfg.method = 'dics';<br>cfg.grid = grid; <br>cfg.vol = vol;<br>cfg.grad = DataOut.hdr.grad;<br>cfg.grid.filter = source.avg.filter; %uses a precomputed filter (common filter)<br>
cfg.rawtrial = 'yes';</div>
<div> </div>
<div>source = ft_sourceanalysis(cfg, freq);</div>
<div> </div>
<div> </div>
<div>A = find(design==1);<br>B = find(design==2);</div>
<div> </div>
<div>sourceA = source;<br>sourceA.trial(B) = [];<br>sourceA.cumtapcnt(B) = [];<br>sourceA.df = length(A);</div>
<div> </div>
<div>cfg = [];<br>cfg.keeptrials = 'yes';<br>sourceA = ft_sourcedescriptives([], sourceA);</div>
<div> </div>
<div>sourceB = source;<br>sourceB.trial(A) = [];<br>sourceB.cumtapcnt(A) = [];<br>sourceB.df = length(B);</div>
<div> </div>
<div>cfg = [];<br>cfg.keeptrials = 'yes';<br>sourceB = ft_sourcedescriptives([], sourceB);</div>
<div> </div>
<div> </div>
<div>%STATS</div>
<div>cfg = [];<br>cfg.parameter = 'pow';<br>cfg.method = 'analytic';<br>cfg.statistic = 'actvsblT';<br>cfg.computestat = 'yes';<br>cfg.computecritval = 'yes';<br>cfg.computeprob = 'yes';<br>
cfg.alpha = 0.05;<br>cfg.tail = 0;<br></div>
<div>stat = ft_sourcestatistics(cfg, sourceB, sourceA);</div>
<div> </div>
<div> </div>
<div> </div>
<div>Thanks for your help,</div>
<div> </div>
<div>Davide</div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>