Learn R Programming

L2E (version 2.0)

l2e_regression: L2E multivariate regression - PG

Description

l2e_regression performs L2E multivariate regression via block coordinate descent with proximal gradient for updating both beta and tau.

Usage

l2e_regression(y, X, b, tau, max_iter = 100, tol = 1e-04, Show.Time = TRUE)

Value

Returns a list object containing the estimates for beta (vector) and tau (scalar), the number of outer block descent iterations until convergence (scalar), and the number of inner iterations per outer iteration for updating beta and tau (vectors)

Arguments

y

Response vector

X

Design matrix

b

Initial vector of regression coefficients

tau

Initial precision estimate

max_iter

Maximum number of iterations

tol

Relative tolerance

Show.Time

Report the computing time

Examples

Run this code
# Bank data example
y <- bank$y
X <- as.matrix(bank[,1:13])
X0 <- as.matrix(cbind(rep(1,length(y)), X))
tauinit <- 1/mad(y)
binit <- matrix(0, 14, 1)

sol <- l2e_regression(y, X0, binit, tauinit)
r <- y - X0 %*% sol$beta
ix <- which(abs(r) > 3/sol$tau)
l2e_fit <- X0 %*% sol$beta

plot(y, l2e_fit, ylab='Predicted values', pch=16, cex=0.8)
points(y[ix], l2e_fit[ix], pch=16, col='blue', cex=0.8)

Run the code above in your browser using DataLab