[Eeglablist] Information about different in ERP/ERSP

ivano triggiani ivanotriggiani at gmail.com
Thu Jan 30 10:33:04 PST 2025


Ciao Daniele,

I think there are several possibilities.

solution 1:
use EEGlab studio, which has a lot of different statistics (some are
similar to the ones in Fieldtrip)

solution 2:
use ERPlab, but I am not familiar anymore with that tool (which I remember
being very good)

solution 3:
Use a simple script, for example:
find the channel number in the list (for example Fp1 is 1, Fp2 is 33, or
use : find(strcmp({EEG.chanlocs.labels}, 'Fp1')) )
so

chan1 = 1;
%extract the average of the time series over the trials (epochs), like:
erp1 = mean(EEG.data(chan1, :, :), 3);
%do the same for chan2
[~, p_values] = ttest(squeeze(EEG.data(chan1, :, :))',
squeeze(EEG.data(chan2, :, :))'); %I am not sure you need to squeeze, but
it won't hurt)

%plot
figure; subplot(2,1,1);
 plot(EEG.times, erp1, 'b', 'LineWidth', 2);
hold on;
plot(EEG.times, erp2, 'r', 'LineWidth', 2);
legend({'Fp1', 'FP22'});
xlabel('Time (ms)');
ylabel('ERP Amplitude (µV)');
title('whatever you want');
subplot(2,1,2); plot(times, p_values, 'k', 'LineWidth', 1);
yline(0.05, '--r'); % Mark the significance threshold xlabel('Time (ms)');
ylabel('p-value');
title('Statistical comparison (t-test)');

Please, check the code. I am not great at coding, so I could messed-up
something, but the idea should work.

Another possibility is to subtract erp1 - erp2 and test it against 0.

Ivano


---

*Antonio Ivano Triggiani, Ph.D.*


________________________________________________



On Thu, Jan 30, 2025 at 3:14 AM Daniele Lozzi <daniele.lozzi at univaq.it>
wrote:

> Hello Ivano, thanks a lot for your answer!
> My goal is to compare two channels in the same condition. I have extracted
> the ERPs from the events and would like to plot the two channels and the
> p-value of the t-test, just as I do for two different conditions on the
> same channels, but I can't figure out which commands to write to do this
> plot or to get the numerical data to plot later.
> Thank you very much for your support!
>
> Regards
>
> Daniele
>
> Il giorno lun 27 gen 2025 alle ore 19:14 ivano triggiani <
> ivanotriggiani at gmail.com> ha scritto:
>
>> EEGlab's GUI is really handy, especially how it shows you past commands
>> with 'EEG history', but it has its limits - of course. I'm trying to figure
>> out what exactly you need. Are you looking for a statistical analysis,
>> maybe to compare the time-series between two channels? Or do you just need
>> a plot? We can easily create a plot using the data in EEG.data if that's
>> what you're after.
>>
>> Ivano
>>
>> ---
>>
>> *Antonio Ivano Triggiani, Ph.D.*
>>
>>
>> ________________________________________________
>>
>>
>>
>> On Mon, Jan 27, 2025 at 11:54 AM Daniele Lozzi via eeglablist <
>> eeglablist at sccn.ucsd.edu> wrote:
>>
>>> Dear EEGlab community,
>>>
>>> I  am using EEGlab to analyze my EEG data and I am encountering some
>>> difficulties in performing a comparison between the ERP and ERSP plots of
>>> different channels within the same experimental condition.
>>>
>>> My goal is to analyze the differences in brain activity between, for
>>> example, the Fp1 channel and the Fp2 channel during the presentation of a
>>> stimulus. Unfortunately, from the software's GUI, I have only been able
>>> to
>>> find the way to compare the same channels in different conditions, but
>>> not
>>> the way to compare different channels in the same condition.
>>> Could you please tell me how I can perform this type of analysis?
>>>
>>> Is it possible that I am missing some functionality of the software, or
>>> is
>>> it necessary to use specific scripts or procedures?
>>>
>>> Thank you in advance for your support and attention.
>>>
>>> Sincerely,
>>>
>>> Daniele Lozzi
>>> _______________________________________________
>>> To unsubscribe, send an empty email to
>>> eeglablist-unsubscribe at sccn.ucsd.edu or visit
>>> https://sccn.ucsd.edu/mailman/listinfo/eeglablist.
>>>
>>


More information about the eeglablist mailing list