glmRidge is used to fit models with ridge penalty.
glmRidge(X, y, o = NULL, lambda = 0.25, family = c("gaussian", "binomial", "poisson"), thresh = NULL, max.iter = 1e+08, intercept = TRUE)
X | is a n*p data matrix. |
---|---|
y | is the response vector of length n. |
o | is the offset vector of length n. |
lambda | is the penalty parameter, can be either a scalar or a vector. If a vector, would apply each element to do a regression. |
family | is a description of the error distribution and link function to be used in the model. In our package, the character string can be "binomial", "gaussian" or "poisson". |
thresh | is the threshold to stop the solver. The comparison would perform between it and the difference of the the adjacent iteration coefficents Euclidean norm . |
max.iter | is the maximum number of iterations to be performed for the optimization. |
intercept | is a boolean value, which indicate whether intercept will be fitted in the function. Default value is TRUE. |
the coefficients vector
n <- 50 p <- 10 X <- matrix(rnorm(n * p), n, p) y <- rbinom(n, 1, 0.6) o <- rnorm(n) glmRidge(X, y, o, lambda = 0.5, family = "binomial", thresh = 0.005, max.iter = 1e5, intercept = TRUE)#> $Coef #> [,1] #> (Intercept) 0.376368445 #> v1 -0.006360464 #> v2 -0.038080452 #> v3 -0.048557363 #> v4 -0.034523501 #> v5 0.119094262 #> v6 -0.051644862 #> v7 0.060031070 #> v8 -0.110999661 #> v9 -0.002666290 #> v10 0.105325680 #>