Computes the Generalized Cross-Validation score for a basis representation. Lower GCV indicates better fit with appropriate complexity.
Usage
basis.gcv(
fdataobj,
nbasis,
type = c("bspline", "fourier"),
lambda = 0,
pooled = TRUE
)Arguments
- fdataobj
An fdata object.
- nbasis
Number of basis functions.
- type
Basis type: "bspline" (default) or "fourier".
- lambda
Smoothing/penalty parameter (default 0, no penalty).
- pooled
Logical. If TRUE (default), compute a single GCV across all curves. If FALSE, compute GCV for each curve and return the mean.
Details
GCV is computed as: $$GCV = \frac{RSS/n}{(1 - edf/n)^2}$$ where RSS is the residual sum of squares and edf is the effective degrees of freedom (trace of the hat matrix).
When pooled = TRUE, the criterion is computed globally across all
curves. When pooled = FALSE, the criterion is computed for each
curve separately and the mean is returned. Use pooled = FALSE when
curves have heterogeneous noise levels.