<div dir="ltr">Hello,<div><br></div><div>I am again confronted to the problem of wanting to use STUDY structure and compute difference waves and compare those differences. I am wondering whether since this 2011 post there has been new development in either EEGLAB or ERPLAB that allow to more easily compute, plot and perform stats on difference waves ?</div>
<div><br></div><div>I just read that since EEGLAB v13 one can use a custom function to be performed on each data set of the study in std_precomp but I am not really sure how I would use it for that purpose.</div><div><br>
</div><div>Any hints and tips are welcome !</div><div>If not I guess I'll stick to Hamish Innes-Brown's workaround described below.</div><div><br></div><div>Best</div><div><br></div><div>A.<br><div class="gmail_extra">
<br><br><div class="gmail_quote">On Tue, Jun 28, 2011 at 7:47 PM, Hamish INNES-BROWN <span dir="ltr"><<a href="mailto:HINNES-BROWN@bionicsinstitute.org" target="_blank">HINNES-BROWN@bionicsinstitute.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi Alexandre, I have thought about using ERPLAB, but as you say, the group analysis/stats is much better in EEGLAB, as long as you don't need to do any subtractions... In ERPLAB, as far as I can see the subtraction is handled easily, but then you need to do the stats and plotting externally anyway (back in matlab, or SPSS, signaplot etc), so I figured it would be easier just to do the subtraction in matlab/EEGLAB anyway, and then figure out how to send the results to the EEGLAB plotting and stats functions.<br>
<br>
I have a solution, but it's not very elegant. I have four conditions (A1 A2 B1 B2), and want to calculate DIFF1 = A2 - A1, and DIFF2 = B2 - B1, and then do plots and stats on DIFF1 vs DIFF2<br>
<br>
1) Proceed as if making an "old-style" (before the STUDY.design feature) study. IE epochs for each condition are saved in separate .set files.<br>
2) Loop though all the set files, making an EEG.erp variable, which is mean(EEG.data, 3). You might need to make that double(mean(EEG.data,3)) if you have previously used the option to use single precision only in the options.eeg file.<br>
3) Now you have an ERP in each set file, one for each subject and condition.<br>
4) Now make separate STUDYs for A1 and A2, and B1 and B2 (2 studies, with 2 conditions in each - STUDYA and STUDYB). Then if you like you can get plots and stats of A1 vs A2 and B1 vs B2.<br>
<br>
5) Load STUDYA, and make a loop doing the subtraction as follows:<br>
<br>
> for ss = 1:length(STUDY.subject)<br>
> erp_DIFFA(:,:,ss) = EEG(ss*2).erp - EEG((ss*2)-1).erp;<br>
> end<br>
<br>
This will subtract all the odd (which should be A1) from even (A2) ERPs you previously made.<br>
<br>
6) Do the same for STUDYB<br>
<br>
You then have a matrix (time, chans, subjects) for DIFFA and DIFFB. To get the grand average you just get the mean across the third dimension.<br>
<br>
DIFFA (time, chans, ss)<br>
DIFFB (time, chans, ss)<br>
<br>
> GAVG_A = mean(DIFFA, 3);<br>
> GAVG_B = mean(DIFFB, 3);<br>
<br>
<br>
7) Then to get the nice plots and stats from the STD functions is a bit tricky. You no longer have these DIFF waves in the STUDY structure, so you cannot use the GUI, and have to fiddle around to get the data in a format that the STD functions like. I have only just worked this out so some things could be wrong, but what I have done is set up DIFFA and DIFFB in a cell array like this:<br>
<br>
> erpdata = {DIFFA; DIFFB};<br>
<br>
Then I have used<br>
> pvals = std_stat(erpdata, 'option', 'value'); to calculate stats between DIFFA and DIFFB.<br>
<br>
The you feed those pvals into the plotting function:<br>
> std_plotcurve(times, erpdata, 'condstats', pvals, 'endless', 'options', 'go', 'here');<br>
<br>
And if you give that the right options and channel locations, you will get a head-shaped plot of your XX channels, with two lines per plot (one for each difference wave), and the grey boxes indicating the significant differences.<br>
<br>
<br>
I hope that is of some help, however I suspect some of the more experienced users might be cringing at this, it's probably not the most efficient way... Probably there is a way to use STUDY.design for instance.<br>
<span class=""><font color="#888888"><br>
-hamish-<br>
</font></span><div class=""><div class="h5"><br>
<br>
<br>
<br>
<br>
-----Original Message-----<br>
From: <a href="mailto:alexandre.lehmann@gmail.com">alexandre.lehmann@gmail.com</a> [mailto:<a href="mailto:alexandre.lehmann@gmail.com">alexandre.lehmann@gmail.com</a>] On Behalf Of Alexandre Lehmann<br>
Sent: Tuesday, 28 June 2011 1:59 AM<br>
To: Hamish INNES-BROWN<br>
Subject: Re: [Eeglablist] plotting and calculating stats on study difference waves<br>
<br>
Hello Hamish,<br>
<br>
I also have trouble comparing difference waves, I couldn't find any clean way to do it.<br>
I am now trying to do it with ERPLAB which easily allows to compute and plot difference waves.<br>
<a href="http://www.erpinfo.org/erplab/erplab-documentation/erplab-manual/Bin_Operations.htm" target="_blank">http://www.erpinfo.org/erplab/erplab-documentation/erplab-manual/Bin_Operations.htm</a><br>
<br>
What I haven't found out yet is whether it offers the same powerful group analysis as the STUDY does.<br>
<br>
Looking forward to knowing if you found another more practical solution,<br>
<br>
Regards<br>
<br>
--<br>
Alexandre Lehmann, Phd<br>
Postdoctoral research fellow<br>
Laboratory for Brain, Music & Sound Research BRAMS - Université de Montréal Pavillon 1420 boul. Mont Royal Case Postale 6128, Station Centre-Ville Montreal (QC) H3C 3J7<br>
<br>
<br>
On Sun, Jun 19, 2011 at 9:13 PM, Hamish INNES-BROWN<br>
<<a href="mailto:HINNES-BROWN@bionicsinstitute.org">HINNES-BROWN@bionicsinstitute.org</a>> wrote:<br>
> Sorry for re-posting but I realised the last time I posted this in HTML format and it got scrubbed..<br>
><br>
><br>
> Hello again, I have recently been working with two STUDYs (12 subjects, two conditions in each study) in which I have calculated some new data for each participant and condition (MGFP), as well as calculated a difference ERP and difference MGFP between the two conditions.<br>
><br>
> So I have:<br>
> STUDY1 - cond1 & cond2, calculated DIFF1<br>
> STUDY2 - cond3 & cond4, calculated DIFF2<br>
><br>
> My general approach has been<br>
> 1. Load STUDY 1 and calculate the ERP for each condition (I have actually done this by looping through an EEG(x).erp variable I inserted earlier, though I now realise I could have got the same info more easily from STUDY.changrp.erpdata)<br>
> 2. Do the subtraction DIFF1 = ERPcond2 - ERPcond1<br>
> 3. Load STUDY 2 and do the same<br>
><br>
> I'm then left with DIFF1 and DIFF2 (each 60 elecs x 500 pts x 12 ss)<br>
><br>
> What I'd like to do is use the std_erpplot function to plot, compare and do the stats on these two new waves, but I don't have the a whole new 'STUDY' structure to go with them. Looking at the the help for std_erpplot it looks like you do need a STUDY as an input.<br>
><br>
> I then had a look through std_erpplot.m to see if I could find an internal plotting function that could work with a [elecs, points, ss] matrix, and I found std_plotcurve. Am I heading in the right direction?<br>
><br>
><br>
><br>
><br>
><br>
><br>
> Hamish Innes-Brown<br>
> Research Assistant<br>
> The Bionics Institute of Australia<br>
><br>
> t: +61 3 9667 7529<br>
> f: +61 3 9667 7518<br>
> e: <a href="mailto:hinnes-brown@bionicsinstitute.org">hinnes-brown@bionicsinstitute.org</a><br>
> w: <a href="http://www.bionicsinstitute.org/profiles/HamishInnes-Brown.html" target="_blank">http://www.bionicsinstitute.org/profiles/HamishInnes-Brown.html</a><br>
> w2: <a href="http://musicalbionics.wordpress.com/" target="_blank">http://musicalbionics.wordpress.com/</a><br>
><br>
> 2nd International Medical Bionics Conference, Phillip Island, 20-23 Nov 2011<br>
> <a href="http://www.iceaustralia.com/medicalbionics2011/" target="_blank">http://www.iceaustralia.com/medicalbionics2011/</a><br>
><br>
><br>
> _______________________________________________<br>
> Eeglablist page: <a href="http://sccn.ucsd.edu/eeglab/eeglabmail.html" target="_blank">http://sccn.ucsd.edu/eeglab/eeglabmail.html</a><br>
> To unsubscribe, send an empty email to <a href="mailto:eeglablist-unsubscribe@sccn.ucsd.edu">eeglablist-unsubscribe@sccn.ucsd.edu</a><br>
> For digest mode, send an email with the subject "set digest mime" to <a href="mailto:eeglablist-request@sccn.ucsd.edu">eeglablist-request@sccn.ucsd.edu</a><br>
><br>
</div></div></blockquote></div><br></div></div></div>