set.seed(0)
b <- c(4,4,4,-6*sqrt(2))
n=150
p=200
truerho=0.5
corrmat=diag(rep(1-truerho, p))+matrix(truerho, p, p)
corrmat[,4]=sqrt(truerho)
corrmat[4, ]=sqrt(truerho)
corrmat[4,4]=1
cholmat=chol(corrmat)
x=matrix(rnorm(n*p, mean=0, sd=1), n, p)
x=x%*%cholmat
feta=x[, 1:4]%*%b
fprob=exp(feta)/(1+exp(feta))
y=rbinom(n, 1, fprob)
nsis=floor(n/log(n)/4)
xtune=matrix(rnorm(n*p, mean=0, sd=1), n, p)
xtune=xtune%*%cholmat
feta=xtune[, 1:4]%*%b
fprob=exp(feta)/(1+exp(feta))
ytune=rbinom(n, 1, fprob)
ISIScoef = INDEPgetfinalSCADcoef(x = x, y = y,
pickind = 1:4, xtune = xtune, ytune = ytune,
family = binomial())
Run the code above in your browser using DataLab