[Eeglablist] Help with LIMO ANCOVA/Regression and STUDY cluster analysis

deniz doruk drdenizdoruk at gmail.com
Sun Feb 14 18:25:22 PST 2021

Hello Cyril,

Thank you very much for your detailed explanations. I really appreciate all you and the others (Arnaud, Ramon) are doing to make advanced EEG analysis more accessible and easier to understand for those who have no or little background in signal analysis and coding (such as myself). 
As a clinician, EEGlab and its plugins have made things much easier for me and I have been able to do analyses and publish data I would not have otherwise.

I have been trying to further analyze the date based on your recommendations, and I have come across a few other minor issues and other things that I would like to double check with you. I apologize for the long email again:

a)study design with 2 independent groups and 1 within subject factor with 2 levels (repeated measures) 
b)pre-compute measures
c)1st level analysis (OLS, no interaction, with a selected timeframe), this createds LIMO files per group

d) As you suggested I created the contrast file [1 -1 0]  and then via limo_batch created the ‘con’ files for  each independent group using the LIMO files that were created after the first level analysis (step c). 

e) Then I  went to ANCOVA —>full scalp analysis—> how many groups? —>enter 2—>chose first con files —>con or beta files—> choose con —>select con files for group1(from step d)—> select con files  for group2—>here it asks which parameters?

Since I am using con files I was not sure what to enter here?  for repeated measure ANOCA (using beta files) I would enter [1 2] for each condition, but with ANCOVA using contrasts, I was not sure what this part is referring to? I tried entering [1], [], [1 2]; [1 2] just to see what happens but it gives different errors…
Am I entering files in wrong order? or making another major mistake?

One another small problem I had was when creating the con files (step d) for each group, after creating  the first con file, the second con file would overwrite it. I simply edited the name of the first con file to avoid this problem, but I am not sure if manually editing the name of the con file will cause other problems at later steps. When I look at the each con files for each group it seems to have the correct file paths for the individual subject subfolders containing the con1 files.

2) STUDY vs LIMO order of files
Just wanted to double check on how LIMO sorts subjects files so that I can make sure that the values in my regressor/covariate file corresponds to the correct subject? I created my regressor/covariate file from STUDY.datasetinfo (last 2 columns), so it follows the same order  subjects are sorted in the STUDY design.  Checking this further, I have come across another issue, but again I am not a coder, and it might be just me mixing things up.

So when I look at “STUDY.limo.subjects", I see that the subjects are sorted in a different order than how they are sorted in “STUDY.datasetinfo". For example row 2 in STUDY.datasetinfo is my subject ’59’, whereas the row 2 in STUDY.limo.subjects is subject ’10’. 

I thought maybe LIMO re-sorts the subjects so I checked the LIMO.mat files under each subfolders created for each subjects (ie. sub-10, sub-11), and then realized that -for example-  the LIMO.mat file under 'sub-59’ has the data from subject ’10’ of the STUDY…
I also checked limo_pipeline_design—> pipeline(i).import.files_in and pipeline(i).import.files_out.

This is an example (I shortened the path here) I have for one the files: 
pipeline(2).import.files_in: /Users/ddc/10_limo_file_tmp1.set
pipeline(2).import.files_out: /Users/ddc/sub-59/design1_GLM_Channels_Time_OLS/LIMO.mat
Here by looking at the data sizes (from LIMO.data under sub-59), I can see that the data from  subject ’10’ (from the STUDY design) is placed under the subfolder 'sub-59'...

Normally it should not matter if each subject has now a different subject code, but looking at the group files (beta or con), they take into account the subject number from the STUDY design, so if my subject 10 is now  sub-59 it would not be assigned to the correct group…

I guess my main question is: What would be the best way to confirm to that the subjects in the STUDY design aligns with LIMO subject subfolders and then with my regressor file? 
I can manually change the name of the sub-folders but I am not sure if this would cause other problems?

3) Regression/plots
Sorry, yes this was not what I had asked before. I am hoping to analyze few other things using regression, and that’s why I also included it here.
Just to confirm:
1-to assess the relationship between a single variable and a covariate, one could use the beta file, then choose the parameter of interest, and then load the regressor file?
2-and to assess if the difference between 2 conditions correlates with the covariate (without accounting for groups such as in ANCOVA), we can use the con file (created using a contrast [1 -1 0]) and then  add the regressor file?

2 minor issues I am having here is when I plot the figures:

1)I can plot the  modeled and adjusted data, but when plotting the original ERP data, it gives the following error.

Unable to perform assignment because brace indexing is not supported for variables of this type.

Error in limo_display_results (line 1454)
                            mytitle{i} = sprintf('Original subjects'' parameters \n sorted by regressor %g channel %s (%g)', regressor(i),
                            LIMO.data.chanlocs(channel).labels, channel);

Error in limo_results>ERP_Callback (line 135)

Error in gui_mainfcn (line 95)

Error in limo_results (line 29)
    gui_mainfcn(gui_State, varargin{:});

Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)limo_results('ERP_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback.

2)When I plot the modeled/adjusted data, values for the covariate seems inaccurate but this only happens sometimes...  I can’t seem to figure out when it plots the correct values and when it does not. For example, despite plotting the same course plot using the same covariate effect.mat file, I get different values plotted for the covariate when plotting it for the second or 3rd time or for a different channel ….I think it sometimes plots the original values but plots the subject ID numbers at other times (see below).

For example these 2 figures were created exactly the same way (Course plot) using the same  covariate.mat file, for the same channel, but each has different values for the sorted variable? The correct values  should be the ones with sorted values  -1.29 to  0.5, but  the other one has 0-23? which is the number of subjects in my design but I could not find the detailed code for the figure to check this further? 

3) This is also very minor, but I thought you may want to know.
When looking at the images of effects (this happens with regression, but also repeatedANOVA etc), clicking on the ‘colored’ areas (which I assume are the significant areas) do not always print the correct p-value in the command window (different than the numbers reported under the variable ‘p_values'). For example below is an example, where the value from the last column and last row prints correctly in the command window (prints the same value  of the ‘p_values’ variable), but when I hover over other colored areas (ie over channels 36-38), it prints a a nonsignificant value, a value that is actually supposed to be significant per the values of the variable ‘p_value’)? 

Thank you very much for help and guidance!

> On Feb 8, 2021, at 1:30 AM, Dr Cyril, Pernet <wamcyril at gmail.com> wrote:
> Hi Deniz
>> Thank you very much for your clarifications. This is very helpful. Just a few follow questions:
>>> the 'best' thing to do would be to compute contrasts, i.e. [1 -1 0] for each subject which is your main effect, then ANCOVA 2 gp and covariates
>> -When I run the first level analysis it only creates 2 beta files, one for each group, but there are not any con files created automatically.
>> Here do you mean, following the first level analysis, I should create contrast files using contrast manager, separately for each independent group, using one-sample t-test and then use these con files in ANCOVA (define contrast [1 -1 0], then run Contrast Manager—> LIMO files for the group —> contrast.mat file —> second level—>one-sample t-test?)
> we cannot infer what users want to do and the number of (simple) contrasts is the binomial coef. of the design matrix rank: N!/K!(N-K)! nchoosek in matlab with N the number of regressors and K from 2 to N which is why this is not automatic (with a 2*2 design, ie 4 conditions that already 11 contrasts but most would be irrelevant)
> you can however automatize this easily: 1st create and save a contrast file as txt or mat (here simply 1 -1 0),  call limo_batch in the command window, choose contrast only, select the list of LIMO files (txt) created by study, select that contrast file -- all subjects will be processed ; now you can use those con files in the ANCOVA as explained below.
>> -From what I understand, if I wanted to test the relation between my covariate and  each condition (for each different repeated measure), then I have to create different study designs for each condition (one condition x 2 groups) since I can not include repeated measure in ANCOVA? 
> that was not what you asked last time ... if you want to check in general relationships between variables and covariates use the 2nd level regression and there you can enter as many things as you want ; your 1st level design remains unchanged
>>>> 2)Regression-LIMO
>>>> I also thought that if ANCOVA did not work, I could run a regression model separately for each independent group.
>>>> In the tutorial it gives an example of creating a first level contrast for each subject, and then run a-sample t-test to create the con files which would be used in the regression model along with the regressor variable. I was wondering if there is a way to use parameters from the repeated measure ANOVA model as they would account for the noise better, or maybe it would not differ much since I used OLS?
>>> well see above -- if you split the ANCOVA covariates (ie use XXXXXX000000 and 00000XXXXX with values) say for age, then you model separately the effect of age for each group - which allws you to test [1 -1] if group differ, [0 0 1 -1] if the effect of age differ, [0 0 1 1] the common effect of age
>> -Here are you referring to post-hoc contrast analysis following ANCOVA? So for the covariate file should I have 2 columns (000XXX  and XXX000) with each column representing values from from one group? 
> yes make two columns for age, that way you can assess the difference in the effect of age between groups (after controlling for overall group difference). Now conceptually, if you were to set up a regression, the group variables would not be present, and a similar post-hoc contrast would also tell you the difference in the effect of age between groups- but without controlling for a possible overall group difference (hence better here to use ANCOVA)
>> Sorry for all the questions, I just wanted to make sure I am doing the right thing! We are getting some excited results with LIMO, so I really hope to be able to finalize my analysis using LIMO, but  at the same time I want to be  confident about the stats and what they mean for when it gets published!
> you are welcome - Arnaud, Ramon and I work hard to get a nice integration but it's only as more people use it we can improve 
> best wishes
> Cyril

More information about the eeglablist mailing list