Dear Prof. Cohen,

Hi,

I am about to finish reading your insightful book on analyzing time series data. And I am really grateful that you have shared your knowledge by writing such an easy-to-understand book.

In chapter 34, In the section you are talking about comparing task-related power changes relative to baseline, I found a discrepancy between the method figure 34.2(A) is representing and the method the actual matlab code is using in the code section demarked as figure 34.3 (lines 93-98).

Judging from Fig 34.2, it appears you shift data points around a cut-off point and then you calculate the baseline, values of which vary on each iteration. However, the code on lines 93-98 is comparing the time-shifted signal against predefined, fixed baseline values denoted by â€śrealbaselinesâ€ť.

Since these two methods produce different results, I was wondering which one is more correct in the context of what book is explaining and how these two methods of permutation are different conceptually? (I feel there is a difference between null hypotheses in the two methods, but I canâ€™t envisage it correctly)

Thanks in advance,

Best regards,

Amir

B.S.

Instead of codes on line 93-98, you can insert these lines and comment or uncomment to see the difference on the final results

for permi=1:n_permutes

```
% Original code
cutpoint = randsample(2:nTimepoints-diff(baseidx)-2,1);
permuted_vals(permi,:,:) = 10*log10(bsxfun(@rdivide,mean(eegpower(:,[cutpoint:end 1:cutpoint-1],:),3),mean(realbaselines,2)) );
% This is based on fig 34.2 A
%newdat = mean(eegpower(:,[cutpoint:end 1:cutpoint-1],:),3);
%permuted_vals(permi,:,:) = 10*log10(bsxfun(@rdivide, newdat, mean(newdat(:,baseidx(1):baseidx(2)),2) ));
```

end