glmLasso is used to fit models with lasso penalty.
glmLasso(X, y, o = NULL, lambda = 1, family = c("gaussian", "binomial", "poisson"), support_stability = NULL, 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". |
support_stability | decides the stop criterian. When the support set stay unchanged for support_stability iterations, it assume that the function is stable enough to stop. |
thresh | is the threshold of the diffrence between adjacent iteration coefficents. Parameter thresh and support_stability can not be set at the same time. |
max.iter | is the maximum number of iterations to be performed for the optimization routine. |
intercept | is a boolean value, which indicates whether intercept will be fitted in the function. Default value is TRUE. |
the coefficients vector
n <- 5 p <- 10 X <- matrix(rnorm(n * p), n, p) y <- rbinom(n, 1, 0.6) o <- rnorm(n) lambda <- c(1:5)/10 glmLasso(X, y, o, lambda, family = "binomial", support_stability = 10, max.iter = 1e7, intercept = TRUE)#> 0.1 0.2 0.3 0.4 0.5 #> (Intercept) 0.9027842 1.0373980 1.151844 1.163927 1.166871 #> v1 0.5935091 0.1644568 0.000000 0.000000 0.000000 #> v2 0.0000000 0.0000000 0.000000 0.000000 0.000000 #> v3 0.0000000 0.0000000 0.000000 0.000000 0.000000 #> v4 0.0000000 0.0000000 0.000000 0.000000 0.000000 #> v5 0.0000000 0.0000000 0.000000 0.000000 0.000000 #> v6 -0.6015076 -0.1239092 0.000000 0.000000 0.000000 #> v7 0.7080804 0.4011838 0.000000 0.000000 0.000000 #> v8 0.0000000 0.0000000 0.000000 0.000000 0.000000 #> v9 0.0000000 0.0000000 0.000000 0.000000 0.000000 #> v10 0.0000000 0.0000000 0.000000 0.000000 0.000000