# examples of using the plasso for logistic regression.
# small p

n = 500
p = 8
b0 = 2
t.beta1 = as.matrix(c(3,1.5,0,0,0,2,0,0))
true.beta = c(b0,t.beta1)
x = mvrnorm (n, rep(0,p),diag(p))
y = rbinom (n, 1, invlogit(b0+x%*%t.beta1))
beta.lasso = lasso_logistic(x,y)		#Lasso estimate
beta.alasso = alasso_logistic(x,y)		#adaptive Lasso estimate
beta.plasso = plasso_logistic(x,y)		#pLasso estimate
cbind(beta.lasso,beta.alasso,beta.plasso,true.beta)

# large p

n = 1000
p = 100
b0 = 2
t.beta1 = as.matrix(c(3,1.5,2,0,0,rep(0,p-5)))
true.beta = c(b0,t.beta1)
x = mvrnorm (n, rep(0,p),diag(p))
y = rbinom (n, 1, invlogit(b0+x%*%t.beta1))
beta.lasso = lasso_logistic(x,y)		#Lasso estimate
beta.alasso = alasso_logistic(x,y)		#adaptive Lasso estimate
beta.plasso = plasso_logistic(x,y)		#pLasso estimate
cbind(beta.lasso,beta.alasso,beta.plasso,true.beta)

