Displaying 1 result from an estimated 1 matches for "lscoef".
Did you mean:
scoef
2011 Aug 06
0
ridge regression - covariance matrices of ridge coefficients
...don't see how to do this
because the code is vectorized using
one svd calculation. The relevant lines from lm.ridge, using X, Y are:
Xscale <- drop(rep(1/n, n) %*% X^2)^0.5
X <- X/rep(Xscale, rep(n, p))
Xs <- svd(X)
rhs <- t(Xs$u) %*% Y
d <- Xs$d
lscoef <- Xs$v %*% (rhs/d)
lsfit <- X %*% lscoef
resid <- Y - lsfit
...
k <- length(lambda)
dx <- length(d)
div <- d^2 + rep(lambda, rep(dx, k))
a <- drop(d * rhs)/div
dim(a) <- c(dx, k)
coef <- Xs$v %*% a
dimnames(coef) <- li...