setup_hrf_library: Setup an HRF Library

View source: R/find_hrf.R

setup_hrf_libraryR Documentation

Setup an HRF Library

Description

This function builds or loads a pre-defined "library" of candidate HRFs, then performs a PCA/truncation to yield a basis set. For instance, if no hrflib is provided, it uses a range of parameters (h1, h2, h3, h4, f1, f2) to generate half-cosine-based HRFs via hrf_half_cosine, calls gen_hrf_library, then does a PCA.

Usage

setup_hrf_library(hrflib = NULL, rsam = seq(0, 24, by = 1), ncomp = 5)

Arguments

hrflib

An optional function that, when given a vector of times, returns a matrix of candidate HRFs as columns. If NULL, a built-in set of half-cosine parameter combinations is used.

rsam

A numeric vector of time points at which HRFs are sampled (default: seq(0,24,1))

ncomp

Number of principal components to keep (default 5)

Value

A list with elements:

L

A matrix of HRFs (columns) from the full library

Lk

A matrix of dimension nrow(L) x ncomp (the first ncomp PCs)

basis_set

A list of HRF functions (one for each PC) created by gen_empirical_hrf


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