search for: xpxi

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

Did you mean: xpi
2011 Aug 06
0
ridge regression - covariance matrices of ridge coefficients
...# 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)) } dimnames(coef) <- list(format(lam...