Selects the optimal number of basis functions using k-fold cross-validation or generalized cross-validation.
Arguments
- fdataobj
An fdata object.
- nbasis.range
Vector of nbasis values to evaluate (default: 4:20).
- type
Basis type: "bspline" (default) or "fourier".
- criterion
Selection criterion: "GCV" (default), "CV", "AIC", or "BIC".
- kfold
Number of folds for k-fold CV (default 10). Ignored if criterion is "GCV", "AIC", or "BIC".
- lambda
Smoothing parameter (default 0).
Value
A list with:
- optimal.nbasis
Optimal number of basis functions
- scores
Score for each nbasis value
- nbasis.range
The tested nbasis values
- criterion
The criterion used
- fitted
fdata object fitted with optimal nbasis