gcv_vem: GCV Score for a VEM Smooth Fit

View source: R/gcv_vem.R

gcv_vemR Documentation

GCV Score for a VEM Smooth Fit

Description

Computes the generalized cross-validation (GCV) score for each curve from a vem_smooth model object. GCV approximates leave-one-out prediction error and is used by tune_vem_by_gcv to select the optimal number of basis functions K.

The smoother matrix S_i maps observed values to fitted values and is constructed from the variational posteriors. Its trace provides the effective degrees of freedom used in the GCV penalty.

Usage

gcv_vem(out, threshold = 0.5)

Arguments

out

A fitted object returned by vem_smooth.

threshold

Numeric in (0,1). Posterior inclusion probability threshold for treating a basis as active. Default 0.5.

Value

A named numeric vector of length m of per-curve GCV scores. Lower scores indicate better fit relative to model complexity.

References

da Cruz, A. C., de Souza, C. P. E., & Sousa, P. H. T. O. (2024). Fast Bayesian basis selection for functional data representation with correlated errors. arXiv:2405.20758. https://arxiv.org/abs/2405.20758

See Also

tune_vem_by_gcv, vem_smooth


fda.vi documentation built on June 20, 2026, 5:06 p.m.