# FunctionalTerm


Specification for a functional covariate.


Usage

``` python
FunctionalTerm(
    name,
    basis="bspline",
    domain=(0.0, 1.0),
    n_basis=15,
    penalty_order=2,
)
```


Describes how one functional (curve-valued) predictor should enter a [FunctionalGAM](FunctionalGAM.md#whittaker.FunctionalGAM): which basis to expand its coefficient function `beta(t)` in, over what domain, at what resolution, and with what roughness penalty.


## Attributes


`name: str`  
Name of the functional covariate in the data dict. The corresponding data entry should be a 2-D array of shape `(n, T)` where `T` is the number of grid points.

`basis: str`  
Basis type for expanding beta(t): `"bspline"` (default), a B-spline basis with a difference penalty, or `"fourier"`, a sine/cosine basis with a penalty on higher frequencies.

`domain: tuple[float, float]`  
Tuple `(t_min, t_max)` specifying the domain of the functional argument. Grid points are assumed equally spaced over this domain.

`n_basis: int`  
Number of basis functions used to represent `beta(t)`. Defaults to 15. Must be `>= 3`.

`penalty_order: int`  
Order of the difference penalty (for B-spline) or derivative penalty (for Fourier), controlling how strongly higher-order wiggliness in `beta(t)` is penalized. Defaults to 2 (penalizes curvature).
