cvnlab / GLMsingle

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

Seeking Assistance with GLMsingle Model Anomalies #123

Open Yujie-cog opened 10 months ago

Yujie-cog commented 10 months ago

I am currently employing GLMsingle with default parameters in Python for rapid event design analysis in fMRI research. My dataset consists of 9-11 runs per subject, with a TR of 1.5 seconds. Each trial in my study involves a 0.5-second stimulus presentation following a 0.5-second fixation period and a jitter ISI.

However, I've encountered an issue. After GLMsingle model fitting, I observed anomalous results manifesting outside the brain region, which has left me perplexed about the potential causes.

For context, I have preprocessed the fMRI data using SPM, including steps like Realign, Coregister, Segment, Normalize, and Smooth. I did not perform Slice Timing as I found it challenging to apply to multi-band sequences. I have attached my code, example of design matrix .

Your guidance and insights would be greatly appreciated. Thank you, Liu Yujie ! brain slice example design_example glm_results_example GLMsingle_code_for_issue.zip

kendrickkay commented 10 months ago

Hi, a few thoughts:

Yujie-cog commented 10 months ago

Thanks for your response!!

  1. ISI in my data is 2-5s. TR = 1.5s. In every sample trial, the flow is : fixation(500ms) - stimulus(500ms) - ISI(jitter), there's another response stage in catch trials(they are coded as a condition). The onsets of data correspond with the start of fixation in trial instead of stimulus. One of my condition is Instructions (they are presented for 4 s). I am also kind of unsure about how to choose 'stimdur' for this data and design ?

  2. About the possibility that experiment just generates very weak evoked responses, I know another person used this data on some trial-based decoding and RSA, so I think it shouldn't be this case .

  3. I didn't find any mistake in the design matrix up to now x), but I will double check all of them.

Here's one example design of a run, I set about last 10s as 0 in analysis.

design

kendrickkay commented 10 months ago

OK, what you said seems fine. I don't necessarily see any problems. Do you think there is a problem?

Regarding stimdur, you can set it to 0.5 or 1 (second). It won't make a big difference, as the shape of the HRF predicted for 0.5 or 1 second of stimulation is very similar.

iancharest commented 5 months ago

A close look at your design matrix suggests that you did not provide "single trial" predictors, which is how GLMsingle expects designs to be input.

kendrickkay commented 5 months ago

@iancharest - can you elaborate on what you mean?

iancharest commented 5 months ago

ok, so looking at the design matrix above, I can see that the trials are concatenated with multiple blips per condition in a column. GLMsingle is optimised as the name says, for estimating single trial betas (which could in the end be averaged across conditions if this is what one wants.) here is an example trial based design matrix:

image

The following example is perhaps useful to then average the single trial betas and convert to t-volumes/maps.

https://github.com/cvnlab/GLMsingle/blob/main/examples/example5_average_single_trial_betas_t_stat.ipynb

kendrickkay commented 5 months ago

Ian, yes, but remember that GLMsingle wants a design matrix with the onsets associated with a given condition to be indicated in a single column (and not separated into multiple columns).