search for: xpxr

Displaying 1 result from an estimated 1 matches for "xpxr".

Did you mean: xptr
2011 Aug 06
0
ridge regression - covariance matrices of ridge coefficients
...;- sum(lmfit$residuals^2) / (n-p) # prepare output coef <- matrix(0, length(lambda), p) cov <- as.list(rep(0, length(lambda))) mse <- rep(0, length(lambda)) # loop over lambdas for(i in seq(length(lambda))) { lam <- lambda[i] XPXr <- XPX + lam * I XPXI <- solve(XPXr) coef[i,] <- XPXI %*% XPy cov[[i]] <- MSE * XPXI %*% XPX %*% XPXI res <- y - X %*% coef[i,] mse[i] <- sum(res^2) / (n-p) dimnames(cov[[i]]) <- list(colnames(X), colnames(X)) } di...