ADMM: Subgroup detection in setting of regression with ADMM...

Description Usage Arguments Value Examples

View source: R/ADMM.R

Description

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.

Usage

1
2
ADMM(Y, X, Z0, penalty, ga = 3.7, nu = 1, lam_vec, maxiter = 1000,
  ep = 5e-04)

Arguments

Y

a n*1 vector, response.

X

a n*p matrix, p-dimensional covariate.

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 lambda for penalty function, which is a vector.

maxiter

The maximum number of iterations. Defaults to 1000.

ep

the absolute convergence tolerance.

peanlty

"SCAD" or "MCP".

Value

Examples

 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)

PengWu12245/RegSubDetect documentation built on Dec. 30, 2019, 6:01 p.m.