The CGV function gives the sum of cross-validated squared errors
that can be used to optimize tuning parameters in ridge regression and
generalized ridge regression.
See Golub et al. (1979), and Sections 2.3 and 3.3 of Yang and Emura (2017) for details.
Usage
GCV(X, Y, k, W = diag(ncol(X)))
Value
The value of GCV
Arguments
X
matrix of explanatory variables (design matrix)
Y
vector of response variables
k
shrinkage parameter (>0); it is the "lambda" parameter
W
matrix of weights (default is the identity matrix)
References
Yang SP, Emura T (2017) A Bayesian approach with generalized ridge estimation
for high-dimensional regression and testing, Commun Stat-Simul 46(8): 6083-105.
Golub GH, Heath M, Wahba G (1979) Generalized cross-validation as
a method for choosing a good ridge parameter. Technometrics 21:215–223.
n=100# no. of observationsp=100# no. of dimensionsq=r=10# no. of nonzero coefficientsbeta=c(rep(0.5,q),rep(0.5,r),rep(0,p-q-r))
X=X.mat(n,p,q,r)
Y=X%*%beta+rnorm(n,0,1)
GCV(X,Y,k=1)