Description Usage Arguments Value Examples
The model is
Y_i = X_i β + Z_i θ_i.
This ADMM algorithm can detect the subgroup effects of θ_i and estimate the regression coefficient β simultaneously.
1 2 | ADMM(Y, X, Z0, penalty, ga = 3.7, nu = 1, lam_vec, maxiter = 1000,
ep = 5e-04)
|
Y |
a n*1 vector, response. |
X |
a n*p matrix, |
Z0 |
a n*q matrix, treatment indicator. |
ga |
a parameter for penalty function, default 3.7. |
nu |
a tuning parameter for augmented Largranian objection function, the default value is 1. |
lam_vec |
a series of candidate tuning parameter |
maxiter |
The maximum number of iterations. Defaults to 1000. |
ep |
the absolute convergence tolerance. |
peanlty |
|
BIC
the values of BIC for each lam_vec
.
lam_opt
the optimal lambda
that have.
the mimimal BIC
.
beta_Est_lam
the regression coefficients matrix
of covariates for different value of lam_vec
, each column denotes a
value of lam_vec
.
theta_Est_lam
the regression coefficients matrix of treatment indicator
for each individuals, each column denotes a different value of lam_vec
.
theta_est_opt
the regression coefficients of treatment indicator for
optimal lambda
.
beta_est_opt
the regression coefficients of covariates for optimal lambda
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | set.seed(1)
n = 200; p = 2
x = matrix(rnorm(n*p, mean = 2), nrow = n, ncol = p) # covariates
z = sample(c(0,1), n, T) # treatment indicator
beta = c(-2, -3) # regression coefficients of covariates
mu = c(-2, 2) # regression coefficients of treatment indicator
y = x %*% beta + z * mu[1] + rnorm(n, sd = 0.5)
index = sample(c(0,1), n, T)
y[index == 1] = y[index == 1] + z[index == 1] * (mu[2] - mu[1])
lam_vec = seq(0,2,0.2)
result = ADMM.q1(y, x, z, penalty = 'SCAD', lam_vec = lam_vec)
result$beta_est_opt
unique( round(result$theta_est_opt, 1) )
# solution paths
py_mu = result$theta_Est_lam
plot(x=lam_vec, y=py_mu[1,], xlab=expression(lambda),
ylab=expression(paste("Estimated value of ", vartheta, sep=" ")),
xlim=c(0,2), ylim=c(min(py_mu),max(py_mu)),
main="Solution path for domain I", type='l')
for(j in 1:nrow(py_mu) ){
lines(lam_vec, py_mu[j,], lty=j, col=j+1,lwd=2 )
}
abline(v=result$lam_opt, lty=3, col="lightblue",lwd =3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.