Hi everyone, I'm Byeol 🤩 and I'm going to walk you through how to make a single-trial model using SPM. 💪🤓
You can download materials (MATLAB code and example data) for this module at here.
This tutorial was created by referring to the code I used in the FAST project. Example code and example data can be obtained at here. The goal of single-trial modeling is to extract brain activity corresponding to each trial by taking an image of one participant, and obtain as many beta images as the number of trials. I was able to get 160 beta images for 40 word-thinking trials over 4 runs per person for 61 participants.
load(fullfile(basedir, 'project/FAST/data/FAST_dataset_fmri.mat'));
% onsets
onsets_view = get_var(D, 'eventonsettime', 'conditional', {'eventname', 'view'});
onsets_emotion_select = get_var(D, 'eventonsettime', 'conditional', {'eventname', 'emotion_selection'});
onsets_concentration = get_var(D, 'eventonsettime', 'conditional', {'eventname', 'concentration'});
% names
names_view = get_var(D, 'eventname', 'conditional', {'eventname', 'view'});
names_emotion_select = get_var(D, 'eventname', 'conditional', {'eventname', 'emotion_selection'});
names_concentration = get_var(D, 'eventname', 'conditional', {'eventname', 'concentration'});
% durations
durations_view = get_var(D, 'eventduration', 'conditional', {'eventname', 'view'});
durations_emotion_select = get_var(D, 'eventduration', 'conditional', {'eventname', 'emotion_selection'});
durations_concentration = get_var(D, 'eventduration', 'conditional', {'eventname', 'concentration'});
The onset_*
, names_*
, and durations_*
variables load the data entered in D(canlab dataset), and the name, start time, and duration of each trial are entered. Each trial's event is divided into three categories: view, emotion_select, and concentration. When modeling underneath, we will use the 'view' and the rest as 'rating'.
In the case of the same event, the sizes of onset_*
, names_*
, and durations_*
are the same. In the case of a *_view
, the number of row is # participants and # column = 160 = # trials, the *_emotion_select
's column is for 20 trials, and in the case of *_concentration
, 8 trials. This is because participants responded emotion_selection 5 times and concentration 2 times per run. names_*
contain the name of the event type, and onsets_*
and durations_*
contain onsets and durations of trials.