<div dir="ltr"><div><div><div>Hello David,<br><br></div>I'm not aware of any built-ins for doing this, but it is fairly straightforward using just basic MATLAB functions. The specifics depend on how your data have been processed, how your trial-level predictor info is coded, etc, how you plan on doing the analysis, etc. Here's a simple example that assumes no trials have been removed (i.e., trial n of EEG corresponds to the nth predictor value that will go into the model), that the predictors are stored in a separate logfile that was generated by the stimulus presentation software (as opposed to, e.g., in the EEG event codes themselves), and that the analysis will only look at one time window and one channel. It could of course be tweaked to handle different situations than those described above.<br><br><br><br></div><div>% the time range (inclusive) to average over<br></div><div>time_window = [150 250];<br><br></div><div>% the channel to use<br></div><div>channame = 'Fz';<br><br></div><div>% find all samples within this time range<br></div><div>samples = find( EEG.times>=time_window(1) & EEG.times<=time_window(end) );<br><br></div><div>% find the index of the channel<br></div><div>chanidx = find( arrayfun( @(x)( strcmpi( EEG.chanlocs(x).labels, channame ) ), 1:EEG.nbchan ) );<br><br></div><div>% get the window mean amplitude for each trial<br></div><div>data = squeeze( mean( EEG.data( chanidx, samples, : ), 2 ) );<br><br></div><div>% write out to text<br></div>dlmwrite( ['voltages_' channame '_' num2str(time_window(1)) '-' num2str(time_window(end))], data );<br><br></div>% the next step is to read those values back into R, along with whatever other file contains the trial-by-trial predictors that you want to regress these values on<br></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><br><br></div>Stephen Politzer-Ahles<br>New York University, Abu Dhabi<br>Neuroscience of Language Lab<br><a href="http://www.nyu.edu/projects/politzer-ahles/" target="_blank">http://www.nyu.edu/projects/politzer-ahles/</a><br></div></div></div>
<br><div class="gmail_quote">On Thu, Jun 18, 2015 at 3:17 AM, David Jackson Morris <span dir="ltr"><<a href="mailto:dmorris@hum.ku.dk" target="_blank">dmorris@hum.ku.dk</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 all and Lampros,
<div><br>
</div>
<div>This is a very interesting thread and it would be good to see a follow-up to this.  I also wonder if anyone has any experience porting preprocessed data to R?</div>
<div><br>
</div>
<div>Best wishes</div>
<div>David</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>
<div>
<div style="margin:0px"><font face="Segoe UI,Helvetica,Arial,sans-serif" size="3"><font color="gray" face="Verdana,sans-serif" size="1"><span style="font-size:7.5pt"><b>David Jackson Morris</b></span></font></font></div>
</div>
<div>
<div style="margin:0px"><font face="Segoe UI,Helvetica,Arial,sans-serif" size="3"><font color="gray" face="Verdana,sans-serif" size="1"><span style="font-size:7.5pt">Postdoc</span></font></font></div>
</div>
<div>
<div style="margin:0px"><font face="Segoe UI,Helvetica,Arial,sans-serif" size="3"><font color="gray" face="Verdana,sans-serif" size="1"><span style="font-size:7.5pt"> </span></font></font></div>
</div>
<div>
<div style="margin:0px"><font face="Segoe UI,Helvetica,Arial,sans-serif" size="3"><font color="gray" face="Verdana,sans-serif" size="1"><span style="font-size:7.5pt"><b>Københavns Universitet/University of Copenhagen</b></span></font></font></div>
</div>
<div>
<div style="margin:0px"><font face="Segoe UI,Helvetica,Arial,sans-serif" size="3"><font color="gray" face="Verdana,sans-serif" size="1"><span style="font-size:7.5pt">INSS/Department of Nordic Studies and Linguistics</span></font></font></div>
<div style="margin:0px"><font face="Segoe UI,Helvetica,Arial,sans-serif" size="3"><font color="gray" face="Verdana,sans-serif" size="1"><span style="font-size:7.5pt">Audiologopædi/Speech Pathology & Audiology</span></font></font></div>
</div>
<div>
<div style="margin:0px"><font face="Segoe UI,Helvetica,Arial,sans-serif" size="3"><font color="gray" face="Verdana,sans-serif" size="1"><span style="font-size:7.5pt">Njalsgade 120</span></font></font></div>
</div>
<div>
<div style="margin:0px"><font face="Segoe UI,Helvetica,Arial,sans-serif" size="3"><font color="gray" face="Verdana,sans-serif" size="1"><span style="font-size:7.5pt">2300 København S</span></font></font></div>
</div>
<div>
<div style="margin:0px"><font face="Segoe UI,Helvetica,Arial,sans-serif" size="3"><font color="gray" face="Verdana,sans-serif" size="1"><span style="font-size:7.5pt"><br>
</span></font></font></div>
<div style="margin:0px"><font face="Segoe UI,Helvetica,Arial,sans-serif" size="3"><font color="gray" face="Verdana,sans-serif" size="1"><span style="font-size:7.5pt">Office 22.5.14</span></font></font></div>
</div>
<div>
<div style="margin:0px"><font face="Segoe UI,Helvetica,Arial,sans-serif" size="3"><font color="gray" face="Verdana,sans-serif" size="1"><span style="font-size:7.5pt" lang="en-US">TLF 35328660 </span></font></font></div>
<div style="margin:0px"><font face="Segoe UI,Helvetica,Arial,sans-serif" size="3"><font color="gray" face="Verdana,sans-serif" size="1"><span style="font-size:7.5pt" lang="en-US"><a href="mailto:dmorris@hum.ku.dk" target="_blank">dmorris@hum.ku.dk</a></span></font></font></div>
</div>
</div>
<div><br>
<div style="font-family:Times New Roman;color:#000000;font-size:16px">
<hr>
<div style="direction:ltr"><font color="#000000" face="Tahoma" size="2"><b>From:</b> Lampros Perogamvros [<a href="mailto:lambros.pero@gmail.com" target="_blank">lambros.pero@gmail.com</a>]<br>
<b>Sent:</b> Tuesday, June 16, 2015 1:44 PM<br>
<b>To:</b> <a href="mailto:eeglablist@sccn.ucsd.edu" target="_blank">eeglablist@sccn.ucsd.edu</a><br>
<b>Subject:</b> [Eeglablist] mixed model for EEG data<br>
</font><br>
</div><div><div class="h5">
<div></div>
<div>
<div dir="ltr">Hi all,
<div><br>
</div>
<div>We were just wondering whether you guys ever implemented a <span>mixed</span>
<span>model</span> analysis for eeg data, and if so how you did it/setup the
<span>model</span>? This model would be ideal when there are unequal numbers of observations per condition, and sometimes 0 observations for a condition for a given subject. This
<span>model</span> would allow us to use all the data and do statistical tests on the individual observations rather than just averaging over all the observations for each subject, so it would be much more powerful. Are you aware of any such model
 for EEG?<br>
<br>
</div>
<div>Thanks!<br>
</div>
<div>Lampros Perogamvros MD<br>
</div>
<div>University of Wisconsin <br>
</div>
</div>
</div>
</div></div></div>
</div>
</div>
</div>

<br>_______________________________________________<br>
Eeglablist page: <a href="http://sccn.ucsd.edu/eeglab/eeglabmail.html" rel="noreferrer" 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></blockquote></div><br></div>