Skip to contents

Computes the Lag-Width-Undershoot (LWU) hemodynamic response function. This model uses two Gaussian components to model the main response and an optional undershoot. The formula is: \deqnh(t; \tau, \sigma, \rho) = e^-\frac(t-\tau)^22\sigma^2 - \rho e^-\frac(t-\tau-2\sigma)^22(1.6\sigma)^2

Usage

hrf_lwu(t, tau = 6, sigma = 2.5, rho = 0.35, normalize = "none")

Arguments

t

A numeric vector of time points (in seconds).

tau

Lag of the main Gaussian component (time-to-peak of the positive lobe, in seconds). Default: 6.

sigma

Width (standard deviation) of the main Gaussian component (in seconds). Must be > 0.05. Default: 2.5.

rho

Amplitude of the undershoot Gaussian component, relative to the main component. Must be between 0 and 1.5. Default: 0.35.

normalize

Character string specifying normalization type: \itemize \item\code"none": No normalization is applied (default). \item\code"height": The HRF is scaled so that its maximum absolute value is 1.

Value

A numeric vector representing the LWU HRF values at the given time points `t`.

See also

Examples

t_points <- seq(0, 30, by = 0.1)

# Default LWU HRF
lwu_default <- hrf_lwu(t_points)
plot(t_points, lwu_default, type = "l", main = "LWU HRF (Default Params)", ylab = "Amplitude")

# LWU HRF with no undershoot
lwu_no_undershoot <- hrf_lwu(t_points, rho = 0)
lines(t_points, lwu_no_undershoot, col = "blue")

# LWU HRF with a wider main peak and larger undershoot
lwu_custom <- hrf_lwu(t_points, tau = 7, sigma = 1.5, rho = 0.5)
lines(t_points, lwu_custom, col = "red")
legend("topright", c("Default", "No Undershoot (rho=0)", "Custom (tau=7, sigma=1.5, rho=0.5)"),
       col = c("black", "blue", "red"), lty = 1, cex = 0.8)


# Height-normalized HRF
lwu_normalized <- hrf_lwu(t_points, tau = 6, sigma = 1, rho = 0.35, normalize = "height")
plot(t_points, lwu_normalized, type = "l", main = "Height-Normalized LWU HRF", ylab = "Amplitude")
abline(h = c(-1, 1), lty = 2, col = "grey") # Max absolute value should be 1