penalty_matrix | R Documentation |
Generate a penalty matrix for regularizing HRF basis coefficients. The penalty matrix encodes shape priors that discourage implausible or overly wiggly HRF estimates. Different HRF types use different penalty structures:
FIR/B-spline bases: Roughness penalties based on discrete derivatives
SPM canonical + derivatives: Differential shrinkage of derivative terms
Fourier bases: Penalties on high-frequency components
Default: Identity matrix (ridge penalty)
penalty_matrix(x, ...)
x |
The HRF object or basis specification |
... |
Additional arguments passed to specific methods |
The penalty matrix R is used in regularized estimation as λ * h^T R h, where h are the basis coefficients and λ is the regularization parameter. Well-designed penalty matrices can significantly improve HRF estimation by encoding smoothness or other shape constraints.
A symmetric positive definite penalty matrix of dimension nbasis(x) × nbasis(x)
nbasis()
, fmrihrf::HRF_objects
Other hrf:
fitted_hrf()
,
nbasis()
# FIR basis with smoothness penalty
fir_hrf <- HRF_FIR
R_fir <- penalty_matrix(fir_hrf)
# B-spline basis with second-order smoothness
bspline_hrf <- HRF_BSPLINE
R_bspline <- penalty_matrix(bspline_hrf, order = 2)
# SPM canonical with derivative shrinkage
spmg3_hrf <- HRF_SPMG3
R_spmg3 <- penalty_matrix(spmg3_hrf, shrink_deriv = 4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.