Description Usage Arguments Value Examples
View source: R/Lasso-function.R
Lasso regression for logistics model
1 | glmlasso(X, y, lambda = 0.1, tol = 1e-06, iter = 100)
|
X |
Design Matrix |
y |
binary outcome |
lambda |
Lasso penalty parameter |
tol |
convergence threshold |
iter |
iteration times |
Lasso estimate of coefficients
1 2 3 4 5 6 7 8 9 10 11 | set.seed(1232)
Nz = 500
pz = 10
Xz = scale(matrix(rnorm(Nz*pz), ncol=pz))
bz = c(.5, -.5, .25, -.25, .125, -.125, rep(0, pz-6))
yz = rbinom(Nz,1,exp(Xz %*% bz)/(1+exp(Xz %*% bz)))
lambda = .1
require(glmnet)
fit <- glmnet(Xz,yz,family="binomial",lambda = 0.1,intercept = FALSE)
coef(fit,s = 0.1)
fit1 <- glmlasso(Xz,yz,lambda,tol=1e-12)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.