# Specifying Epochs within GLM process

**URL:** <https://mne.discourse.group/t/specifying-epochs-within-glm-process/8783>\
**Category:** Support & Discussions\
**Tags:** fnirs, epochs\
**Created:** [May 9, 2024, 10:06pm UTC](https://mne.discourse.group/t/specifying-epochs-within-glm-process/8783 "2024-05-09T22:06:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![AbbieM](https://avatars.discourse-cdn.com/v4/letter/a/ccd318/32.png) [@AbbieM](https://mne.discourse.group/u/AbbieM)\
**Post date:** [May 9, 2024, 10:06pm UTC](https://mne.discourse.group/t/specifying-epochs-within-glm-process/8783/1 "2024-05-09T22:06:54Z")

</div>

Hello! I am running a GLM analysis on fNIRS data and have a question about setting stimuli duration and establishing baseline. The chunks of data + stimuli to be analyzed are 10 seconds long. I have been setting my stimuli duration in the design matrix to 10 seconds. However, I would also like to capture a snippet of the baseline state about 2 seconds before the stimuli onset. I can do this easily with block averaging but is there a way to do this within the design matrix for the GLM function? I appreciate any insight or help, thanks so much!

- NE version: e.g. 1.6.1
- operating system: Windows 10

```python
raw_haemo = beer_lambert_law(raw_od, ppf=0.1)
    raw_od.resample(.3) 
    sht_chans = get_short_channels(raw_haemo)
    raw_haemo = get_long_channels(raw_haemo)

    design_matrix = make_first_level_design_matrix(raw_haemo, 
                                                   drift_model = 'cosine',
                                                   high_pass = 0.015,
                                                   hrf_model = 'spm',
                                                   stim_dur=10)    

    # Append short channels mean to design matrix
    design_matrix["ShortHbO"] = np.mean(sht_chans.copy().pick(picks="hbo").get_data(), axis=0)
    design_matrix["ShortHbR"] = np.mean(sht_chans.copy().pick(picks="hbr").get_data(), axis=0)
    
    # Run GLM
    glm_est = run_glm(raw_haemo, design_matrix)

```
