[Eeglablist] mixed model for EEG data

Stephen Politzer-Ahles spa268 at nyu.edu
Sat Jun 20 22:48:52 PDT 2015

Hello David,

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.

% the time range (inclusive) to average over
time_window = [150 250];

% the channel to use
channame = 'Fz';

% find all samples within this time range
samples = find( EEG.times>=time_window(1) & EEG.times<=time_window(end) );

% find the index of the channel
chanidx = find( arrayfun( @(x)( strcmpi( EEG.chanlocs(x).labels, channame )
), 1:EEG.nbchan ) );

% get the window mean amplitude for each trial
data = squeeze( mean( EEG.data( chanidx, samples, : ), 2 ) );

% write out to text
dlmwrite( ['voltages_' channame '_' num2str(time_window(1)) '-'
num2str(time_window(end))], data );

% 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

Stephen Politzer-Ahles
New York University, Abu Dhabi
Neuroscience of Language Lab

On Thu, Jun 18, 2015 at 3:17 AM, David Jackson Morris <dmorris at hum.ku.dk>

>  Hi all and Lampros,
>  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?
>  Best wishes
> David
>   *David Jackson Morris*
>  Postdoc
>  *Københavns Universitet/University of Copenhagen*
>  INSS/Department of Nordic Studies and Linguistics
> Audiologopædi/Speech Pathology & Audiology
>  Njalsgade 120
>  2300 København S
>  Office 22.5.14
>  TLF 35328660
> dmorris at hum.ku.dk
>  ------------------------------
> *From:* Lampros Perogamvros [lambros.pero at gmail.com]
> *Sent:* Tuesday, June 16, 2015 1:44 PM
> *To:* eeglablist at sccn.ucsd.edu
> *Subject:* [Eeglablist] mixed model for EEG data
>   Hi all,
>  We were just wondering whether you guys ever implemented a mixed model
> analysis for eeg data, and if so how you did it/setup the model? 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 model 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?
>  Thanks!
>  Lampros Perogamvros MD
>  University of Wisconsin
> _______________________________________________
> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
> To unsubscribe, send an empty email to
> eeglablist-unsubscribe at sccn.ucsd.edu
> For digest mode, send an email with the subject "set digest mime" to
> eeglablist-request at sccn.ucsd.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20150621/39141f87/attachment-0001.html>

More information about the eeglablist mailing list