cvnlab / GLMsingle

A toolbox for accurate single-trial estimates in fMRI time-series data
BSD 3-Clause "New" or "Revised" License
98 stars 42 forks source link

Use round(L/2) for a maxpolydeg #93

Closed jungtak05 closed 11 months ago

jungtak05 commented 1 year ago

Hi,

First of all, thank you for providing the fancy toolbox.

While reading the paper, I noticed that you included polynomials of degrees 0 through round(L/2) to characterize the baseline signal level. Here, L represents the duration in minutes of the run. However, I am curious about the specific methodology employed to determine the number of regressors. Unfortunately, I couldn't find detailed explanations or references regarding this aspect.

Additionally, when I applied GLMsingle to my data in the MATLAB, using round(L/2) (in our experiment, L/2=22.75) resulted in NaN values for the last regressor. The specific errors prompted are mentioned below.

However, when I used floor(L/2) instead (in our experiment, L/2=22.75), the error did not occur. I would like to know if it is acceptable to use the floor function instead of round in this case.

I would appreciate any help.

All the best, Jungtak Park

DIAGNOSTICS : There are 1 runs. The number of conditions in this experiment is 9. The stimulus duration corresponding to each trial is 2.30 seconds. The TR (time between successive data points) is 2.00 seconds. The number of trials in each run is: 206. The number of trials for each condition is: [25 25 24 19 20 19 24 25 25]. For each condition, the number of runs in which it appears: [1 1 1 1 1 1 1 1 1]. For each run, how much ending buffer do we have in seconds? 16. Saving design-related results to /home/jungtak/HDD/timeExp/fMRI_experiment/fmri_analysis/GLMsingle-main/matlab/time_experiment/output_round/GLMsingle_sub05/DESIGNINFO.mat. FITTING DIAGNOSTIC RUN-WISE FIR MODEL Warning: abs value of divisor is less than 1e-5. we are treating the divisor as 0.

In zerodiv (line 51) In unitlength>@(x,y)zerodiv(x,y,cast(NaN,class(m)),wantcaution) (line 84) In unitlength (line 84) In constructpolynomialmatrix (line 31) In GLMestimatemodel (line 377) In GLMestimatesingletrial_round (line 721) In parallel_function>make_general_channel/channel_general (line 847) In remoteParallelFunction (line 67) Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND = NaN. In olsmatrix (line 54) In projectionmatrix (line 33) In GLMestimatemodel (line 378) In GLMestimatesingletrial_round (line 721) In parallel_function>make_general_channel/channel_general (line 847) In remoteParallelFunction (line 67) Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND = NaN. In olsmatrix (line 54) In projectionmatrix (line 33) In GLMestimatemodel (line 388) In GLMestimatesingletrial_round (line 721) In parallel_function>make_general_channel/channel_general (line 847) In remoteParallelFunction (line 67)

image

kendrickkay commented 1 year ago

Hi,

Regarding the polynomial degree, there is some prior work pertaining to that in these papers: http://www.ncbi.nlm.nih.gov/pubmed/24381539 http://www.ncbi.nlm.nih.gov/pubmed/17394212

Ultimately, it's just a heuristic for the low frequency drift that typically occurs in fMRI data.

Your experiment appears to have a very very long run? You may wish to consider breaking the run into several smaller parts. That way, you can have "repeats of conditions" perhaps across runs, which will allow you to use the GLMdenoise and RR components of GLMsingle.

The error you have encountered is likely due to numerical precision issues in creating polynomials of such high degree. It is totally fine to specify "floor" or a lower number of degrees. Alternatively, if you do split your run into smaller parts, it will likely avoid the error.

iancharest commented 11 months ago

Could you check whether you still get this issue with the latest release of GLMsingle? If so, feel free to reopen this issue.