hello my name is arnold delore and this
presentation
is about general linear modeling in eg
lab limo
there are two parts to this presentation
the first one has to do with theory
and the second one with practice
eeg lab has been developed by ourselves
gcsd
and nemo has been developed by cyril
perne at the university of edinburgh
with input from us
limo is one of the most important
plugins
of eeg lab in this presentation there's
a lot of statistics
i want to mention though that i'm not a
statistician
this is actually good because you might
actually stand a chance to understand
what i'm talking about
however although i'm convinced that none
of the concepts in this presentation are
inaccurate
there might be simplifications which the
statistician would judge
outrageous so bear that in mind
first i'm going to explain to you why we
use the general linear model
the general model is a method that
encompassed
more statistics you might already know
such as t-test
simple regression multiple regression
anova and cova
et cetera but it also allows
designing more complex model as i will
explain here
so first a regression is a linear model
imagine a psychophysics experiment where
images
with different contrasts are presented
and we ask participants to press a
button whenever they see an animal
this is actually an experiment we've
done and this is the histogram of
reaction time for different level of
contrast
now we want to model this behavior with
a linear regression
our model is that the reaction time is
equal to a factor multiplied by the
contrast of the image
plus a constant and a narrow term
we will call this constant beta0 which
is the intercept
and this factor beta1 which is the slope
we can do some simple calculation or
used our preferred software
to find the parameter beta0 and beta1
but best
satisfy this formula here for example we
obtain a beta0 of 2.7 and a beta 1 of
23.6 so we have built a simple linear
model which is a type of
glm here is another representation of
this model
for each trial we have a different error
and we try to minimize this error
now to test if the model is useful we
can compute significance
to do so we compare the fit of this
model so the r
square value with the fit of a simpler
model where we would not have the
parameter beta1
we can also calculate the confidence
interval of the beta1 parameter and
access if
0 is included in the 95 confidence
interval of beta1
if zero is not included it means that
beta1 is significantly different from
zero
so this was a simple if not the simplest
form of glm
now an anova is also a gener a linear
model
imagine an experiment where you have you
would have three categories of images
containing an animal
you would still respond only when the
image contains an animal
but now we want to know if people
respond faster
on images of reptile than on images of
fishes of bird
for example there might be an
instinctive response to be faster to
move
when we see a snake or another reptile
to do so we would use this type of
linear model
where we now have one beta parameter per
category of animal
that is to say the data for example
reaction time is equal to a constant
term
the grand mean beta0 plus the effect of
treatment beta one for fishes
a beta two for birds beta free for
reptiles
and the error term epsilon for example
for trial four which would be the first
presentation of fishes
we have reaction times is equal to beta0
plus beta2 plus the error term
for trial 13 which would be the second
trial containing an image of birds
we have the same relationship with a
different error term
note that beta2 is a number that cannot
vary across trials
only the error vary across trials for a
given category of image
we would have a similar relationship for
reaction times on images of
fishes where we use beta1 and for
reptiles where we use
we would use beta-free the anova
variables
are categorical variables that can only
be zero
and one in this case including the type
of animal
and the contrast variable in the
previous slide was a continuous variable
that could take any value to assess if
the model is significant
the fit of the model with the beta
parameter for each category the r
square is compared with the fit of the
mole without these beta parameters
if it is significantly different the
anova is significant
again this is a gnm that is strictly
equivalent to performing
an anova now a
glm can actually model both a regression
and an anova at the same time which is
an ancova
still using the same example now we vary
both the category of the target image
and the contrast
against again we measure reaction time
for example for a trial that contains a
bird
at a given contrast we would have the
beta parameters corresponding to the
anova as we saw in the previous slide
plus the beta parameters in this case
beta 4 corresponding to contrast
as you can you can see how easy it is to
create more complex glm
and add new variables both continuous
for regression and categorical
for anova now let's see how we can
easily visualize which beta parameter is
associated with each trial
imagine we have 12 trials and four
groups of images
so gp represent groups here so we have
three trials for image of group one
three trials of
image of group two etc this is exactly
the same as we've done with images of
different types
for the anova except now we have four
groups instead of three also we have the
result
now in variable y instead of reaction
time
we can represent these 12 equations
using matrix notation where we have a
column vector representing the result
which is equal
to the design matrix containing 0 and 1
multiply by
a vector of beta parameters plus some
error
the design matrix is often represented
by this type of checkerboard
where we encode ones as white cells and
zeros as black cells and you'll often
see this type of representation
in the literature now let's move to eeg
and erp processing let's first look at a
single electrode and
focus on the first sample of multiple
trial
each trial is a correspond as a
corresponding row
in the design matrix here we have two
categories of stimuli and a continuous
parameter which is the noise in the
stimulus
for example it can be a noisy image you
can see that the noise column
in the noise column that we have gray
level indicating we have more than zero
and once
we have a full gradient of noise values
to fit the glm we optimize beta
parameters at each
latency and we do that interior pvd at
all latencies
so we have a lot of glm to fit
so now we have beta1 beta2 etc
across time and we can build erp like
diagrams out of them
so we can access the eeg data
respond to the presentation of different
types of stimuli
for continuous variable in this case the
stimulus noise level we have an image
the 3d image in this case trials have
been sorted by the amount of noise
so we can clearly see how the amount of
noise
affects single trial beta erp
what is the difference between fitting a
glm on one hand
and doing two separate statistical
analysis a regression
plus an anova of the eeg on the other
hand
looks like it's the same right well it's
not
the advantage of doing both at the same
time
when we fit the glm is that we regress
out contribution of other factors
assuming the beta parameters
corresponding to the noise
model accurately the response of the eg9
to noise content of the image
when we fit when the glm fits better
parameters for the type of image so the
anova part
it does that independently of the noise
it does it as if we the noise had been
removed
by contrast if you fit a regression on
one hand
and an anova on the other hand the
computation of beta for the anova might
be biased by the noise content
of the stimulus
to assess if we have a significant
difference between types
of images we can also subtract the beta
parameters
and assess if 95 the 95 confidence
interval
of the difference overlap with zero if
it does the beta parameters is not
significant uh and to calculate the
95 confidence interval of the difference
we could use
parametric statistics but we usually use
bootstrap where
we repetitively take a subsample of
trial
and we compute the model to determine
how the beta parameters are affected
i put a link in the description on the
lecture on confidence interval bootstrap
and statistics
and of course we have more than one
electrodes
so we have to repeat that for all
electrodes
then we can extract scalp topography of
beta parameters at latency of interest
and also assess significance using the
95 confidential
interval as i just mentioned when you
only have
two types of stimuli instead of scalp
topographies
of beta we can also plot scalp
topography of
eeg potential difference between
stimulus type
then we can use the same mass for
significance as we were using for the
beta parameters
again if you just have two types of
stimuli
in your model applying this mask would
be equivalent to performing a t-test
between your sets of erp for each
stimulus
and thresholding the scale topography at
a p-value of 0.05
note that we really fit a large number
of models here
one model at each sample multiplied by
the number of electrodes
so of course we need to correct for
multiple comparison
there's multiple ways to correct for
multiple comparison
and invite you to again look at the
statistics lecture link in the
description for more information
i want to point on this point out on
this slide that even for a given
experiment you can
model your data in different ways for
example
say you have four types of visual
stimuli
red this green disk red square and green
square
the default design matrix is to have one
beta factor for each type of stimulus
this is called an interaction design and
is shown
here in section one with this design you
can still compare between red and green
stimulus by
summing betters for example difference
between red and green would be beta1
plus beta3 minus beta2
and beta4 difference between square and
circle would be beta1 plus beta2
minus beta3 and beta4 alternatively
you can model it differently with one
beta for square one beta for circle one
beta for green
and one bit f for the red color this is
called a factorial design
now square versus circle is beta one
minus beta two and red
versus green is better 3 minus beta 4.
this type of design is rarely used but
it's still valid
a third design which is called the full
factorial design will combine both
it will model model both
main effect of each stimulus
characteristics and interaction between
them
what do i mean by interaction for
example it might be that
shape has an effect on the eg that color
has another additive effect
but but red square have a very special
effect
there is an interaction between the two
characteristics
red and square that leads to unique eg
characteristics
the full factorial design can be used
when you want to study interaction at
the single subject
level however however otherwise
interactions are usually modeled at the
second level and we'll see that in a
second
so i've shown you how to apply a glm at
the single subject level
we can even perform statistics across
trial for single participants
now let's move to the group level
analysis
well group level analysis is simple it's
the same as performing group level
analysis of erps however instead of
using
average electro time course for each
subject as input
we use beta time course as input instead
of using the grand average erp for a
given type of stimulus
we use the grand average beta parameter
representing that type of stimulus
if you have a simple model with only
different types of stimulus in your
model
performing statistics on the beta will
actually be equivalent
as performing statistics on erp now that
this is true only if you're using the
ordinary square method to optimize
parameters if you're using the
alternative
weighted least square method then there
is automatic waiting of individual
trials to minimize artifacts
so we no longer have the equivalence
with channel earpiece
also if you include continuous variable
variables this will not be equivalent as
i explained
previously so in this specific case we
can perform a two-way repeated measure
anova
or the equivalent eglm design the first
main effect will be
will indicate the influence of shape on
the eeg data
the second main effect will indicate the
influence of color
and the interaction turns possible
interaction between shape and color
this is why you do not need to compute
interactions at the first level
instead you do it at the second level as
you would have done with erp
again this must be done at each latency
for each electrode so we will need to
correct for multiple comparisons
i mentioned previously that you could
also use a four factorial design model
at the first level
in this case you have already extracted
interactions at the first level
so you cannot recompute them at the
second level if you have a four
factorial
uh design model at the first level you
could use a two sample
pair t test between the beta f or square
and
beta for disk to assess the effect of
shape
the effect of color would be a group two
sample
paired t test between beta for red and
beta for green
and for interaction effect we can
perform a one sample t test to assess if
any of the interaction terms
are different from zero across subjects
this second model makes sense if you
want to study interaction at a single
subject level
limo and eg lab will use the model on
the previous slide by default
but they allow you to use that model as
well also i want to reiterate that this
is not
this is a high level explanation there's
a lot of detail
pertaining to the optimization of these
models
and the statistical assumptions for
using them for example i mentioned on
this line and the previous one
that we simply apply another glm at the
second level
however at the second level instead of a
standard glm serial porn is using
hoteling statistical tests
which do not need to be corrected for
sphericity of the data and for potential
correlations between measure measures i
invite you to look at the relevant
publications in the
link in the description finally and this
is my last slide
why do a complex two-level hierarchy
called glm model
why we could use a simpler mix effect
model where
we model the different participants
using additional beta parameters
so this is represented here on the left
you can see
that now i have a design matrix that
represents all the trials from all the
participants
with three additional columns at the
beginning to indicate which participant
the trials belong to
if the trials belong to subject one i
put one in the first column
of his design matrix if a trial belongs
to subject two i put one a second column
of his design matrix etc
this does seem much simpler and elegant
and again it's perfectly fine to use
this model
however in practice both when using nemo
and when using
spm for fmri the two-level hierarchical
model is preferred
the reason is first computational the
model with all the participants
is going to be very large and take a
long time to process
not all the data may fit in memory so
there are additional practical
considerations in practice steering
pernae has showed that both models
return comparable results
so even though the mix model effect
is the more theoretically valid it is
fine to use the
yorkicon model instead and again this is
what people have been doing in fmri for
the past 25 years
i put a link to his paper in the
description
i also want to point out that some
researchers
use glm on eeg data in a different way
for example some researchers have used
beta parameters to model
time this is for example useful when you
have stimuli
that overlap in time or it might be
possible to use beta parameters to model
electrodes so it's not necessary to run
a glm for each time
sample and each electrode everything
would be already included in the model
at the cost of having a model with a
very very large number of
beta parameters so this approach is not
possible by limo
but it's good to know that it exists so
i hope you know a little bit more about
g m right now and i want to thank you
for your attention
and maybe see you in one of the next
video