single_trial_regressor: Create a single trial regressor

View source: R/regressor.R

single_trial_regressorR Documentation

Create a single trial regressor

Description

Creates a regressor object for modeling a single trial event in an fMRI experiment. This is particularly useful for trial-wise analyses where each trial needs to be modeled separately. The regressor represents the predicted BOLD response for a single event using a specified hemodynamic response function (HRF).

Usage

single_trial_regressor(
  onsets,
  hrf = HRF_SPMG1,
  duration = 0,
  amplitude = 1,
  span = 24
)

Arguments

onsets

the event onset in seconds, must be of length 1.

hrf

a hemodynamic response function, e.g. HRF_SPMG1

duration

duration of the event (default is 0)

amplitude

scaling vector (default is 1)

span

the temporal window of the impulse response function (default is 24)

Value

A single_trial_regressor object which inherits from regressor with the following components:

  • onsets: The onset time of the trial

  • duration: The duration of the trial

  • amplitude: The amplitude of the trial response

  • hrf: The HRF object used for convolution

See Also

regressor for creating multiple trial regressors, evaluate.single_trial_regressor for evaluating the regressor, HRF_SPMG1 for the default HRF

Examples

# Create a single trial regressor with default HRF
reg <- single_trial_regressor(c(10), HRF_SPMG1)

# Create a single trial regressor with custom HRF and amplitude
reg <- single_trial_regressor(c(10), HRF_GAMMA, amplitude = 2)

# Evaluate the regressor over a time grid
grid <- seq(0, 30, by = 0.5)
values <- evaluate(reg, grid)


bbuchsbaum/fmrireg documentation built on March 1, 2025, 11:20 a.m.