Description Usage Arguments Value Examples
Selecting the optimal ridge regression parameters by GCV
1 | k_choose1(X, Y, kmax, N)
|
X |
the independent variable |
Y |
the response variable |
kmax |
the maximum value of the ridge regression parameter |
N |
the number of cross validation |
the optimal ridge regression parameter
1 2 3 4 5 6 7 8 9 10 | ## Not run:
library(MASS)
data <- read.table("E:/Rcpp/data.txt", header = TRUE)
x <- as.matrix(data[,2:21])
y <- data[,1]
k_best1 <- k_choose1(x, y, kmax = 2, N = 2000)
print(k_best1)
#compare with the optimal parameter gotten by existing ridge package
select(lm.ridge(y~x, data = data, lambda = seq(0,2,0.001)))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.