Extract and construct smooth terms from a formula containing
s(), te(), ti(), or t2() terms. Requires the mgcv package.
Uses the smooth2random decomposition (same approach as brms) to
convert penalised smooth bases into fixed + random effect components
suitable for HMC/NUTS sampling.
Value
A list with components:
- fixed_formula
The formula with smooth terms removed (parametric part).
- smooth_Xf
Combined fixed-effects design matrix from all smooths (n x p_fixed).
- smooth_Zs
List of random-effects design matrices (each n x p_j).
- smooth_info
List of metadata for each smooth (label, type, rank, etc.).
- n_smooth_fixed
Number of smooth fixed-effect columns.
- n_smooth_random
List of dimensions per random-effect block.
