LIMO-EEG-Toolbox / limo_tools

Hierarchical Linear Modelling for MEEG data
https://limo-eeg-toolbox.github.io/limo_meeg/
Other
59 stars 27 forks source link

"No bootstrap file found to compute cluster distribution" even though it exists #41

Closed Bysmuth closed 4 years ago

Bysmuth commented 4 years ago

I am using OS X 10.13.6, MATLAB R2018b, EEGLAB v2019.1, and LIMO v2.0.

Sometimes, when attempting to view the results of a stage 2 analysis (via Results –> Image All –> selecting an R2.mat file, with MC Correction = Clustering), the toolbox returns the error "missing data: no bootstrap file was found to compute the cluster distribution". I have verified that my working directory is set correctly and that the H0 subfolder was created during the analysis.

This appears to be due to the fact that limo_cluster_test.m only initializes the variable maxval (on line 56) if nposclusters~=0. Subsequently, maxval is set equal to max(maxval) (on line 62), which fails when nposclusters==0 because maxval was never initialized. This in turn generates an error that is ultimately handled via the try-catch statement on line 108 of limo_stat_values.m, which returns the observed error message.

If the error here is really just a question of initialization (as opposed to there being an issue with cluster identification), it can be easily fixed by initializing maxval = 0 just before the conditional statement on line 54 of limo_cluster_test.m.

CPernet commented 4 years ago

as discussed by email - WLS branch works right?

Bysmuth commented 4 years ago

I've only run analyses using OLS, so I can't say one way or the other. I just tried running the first-level analysis with WLS instead to address your question, and processing fails at the glm stage. (For the exact same analysis, it succeeds with OLS.) This is with a slightly customized, older version of the (v2.0) toolbox rather than the current one. If you want me to pull the current version and try again, let me know and I can do that.

CPernet commented 4 years ago

sure you can try the WLS branch, and if you do not have enough observations still use OLS for estimation

Bysmuth commented 4 years ago

I pulled the current version and confirmed that (for three subjects across two experiments) it still fails at the glm stage of 1st-level analysis with the WLS branch. For one experiment, the only variable was a 3-level categorical variable (condition); both subjects had between 90 and 100 trials in each of the 3 conditions, or ~300 trials total, and both failed at glm. For a different experiment, the variables were 3 continuous variables, and the subject had 757 trials; their data failed at glm as well.

Note that I can run WLS on subject 1 from the tutorial dataset with no problems, even when I reduce the number of trials in the dataset (and variable files) to 300.

I've posted a small dataset and categorical variable file for one of the subjects for whom WLS fails at glm here in case you would like to examine it. I run the first-level analysis with the following settings: Analysis type: ERP Starting time: 0 ms Ending time: 499 ms Categorical variables: Categorical variables.mat Branch: [Works with OLS, does not work with WLS] (No other changes from defaults: 'full factorial' OFF, 'do not z-score regressors' OFF, 'scalp data' ON, 'components' OFF, 'Bootstrap data' OFF.)

CPernet commented 4 years ago

you can figure out the glm error following the explanation here https://github.com/LIMO-EEG-Toolbox/limo_tools/wiki/debugging-1st-level-stats

the issue for WLS is less trials than frames so if your time course is long this won't work (also looking at how to indicate this better ... )

if you share subjects, i can check what's up

Bysmuth commented 4 years ago

Thank you, I had missed the fact that "enough trials" is defined based on number of frames (if this information was included in the tutorial, I missed it). Most of my data is sampled at 1000 Hz, so even hundreds of trials are not necessarily enough when my epochs are between 500 and 1000 ms. I verified that downsampling my data allows the WLS to proceed.

Regarding the original issue I reported here ("No bootstrap file found"): I was unable to reproduce it with the mini-WLS analysis I ran, but it's hard for me to know the reason. I opened this issue before the F/p value issue was fixed for the corrected R2 analyses and don't know whether that fix could have changed possible outputs. Alternatively, even if the issue did exist I might not have observed it here if the WLS analysis I ran just now returned nposclusters~=0.

Sorry I can't be more helpful. If the problem is now solved in the OLS branch and you think it is not likely to apply to the WLS branch, then (from my perspective) this issue could probably be closed.

CPernet commented 4 years ago

I did just add a note in the tutorial about WLS that - thx Could have been some naming issue regarding not finding files - I now use data = load(file) and data=data.(cell2mat(fieldnames(data))) --> never a name problem anymore (hopefully) ; but could be bits of old code not properly updated