Learn R Programming

rbridge (version 1.0)

rbridge: Fit a Restricted Bridge Estimation

Description

Fit a restricted linear model via bridge penalized maximum likelihood. It is computed the regularization path which is consisted of lasso or ridge penalty at the a grid values for lambda

Usage

rbridge(X, y, q = 1, R, r, lambda.min = ifelse(n > p, 0.001, 0.05),
  nlambda = 100, lambda, eta = 1e-07, converge = 10^10)

Arguments

X

Design matrix.

y

Response vector.

q

is the degree of norm which includes ridge regression with q=2 and lasso estimates with q=1 as special cases

R

is m by p (m<p) matrix of constants.

r

is a m-vector of known prespecified constants. If it is given true restriction, then $$r - R\beta = 0.$$ Values for r should be given as a matrix. See "Examples".

lambda.min

The smallest value for lambda if n>p is 0.001 and 0.05 otherwise.

nlambda

The number of lambda values - default is 100

lambda

A user supplied lambda sequence. By default, the program compute a squence of values the length of nlambda.

eta

is a preselected small positive threshold value. It is deleted jth variable to make the algorithm stable and also is excluded jth variable from the final model. Default is 1e-07.

converge

is the value of converge. Defaults is 10^10. In each iteration, it is calculated by sum of square the change in linear predictor for each coefficient. The algorithm iterates until converge > eta.

Value

An object of class rbridge, a list with entries

betas

Coefficients computed over the path of lambda

lambda

The lambda values which is given at the function

Details

In order to couple the bridge estimator with the restriction R beta = r, we solve the following optimization problem $$\min RSS w.r.t ||\beta||_q and R\beta = r. $$

See Also

cv.rbridge

Examples

Run this code
# NOT RUN {
set.seed(2019) 
beta <- c(3, 1.5, 0, 0, 2, 0, 0, 0)
p <- length(beta)
beta <- matrix(beta, nrow = p, ncol = 1)
p.active <- which(beta != 0)

### Restricted Matrix and vector
### Res 1
c1 <- c(1,1,0,0,1,0,0,0)
R1.mat <- matrix(c1,nrow = 1, ncol = p)
r1.vec <- as.matrix(c(6.5),1,1)
### Res 2
c2 <- c(-1,1,0,0,1,0,0,0)
R2.mat <- matrix(c2,nrow = 1, ncol = p)
r2.vec <- matrix(c(0.5),nrow = 1, ncol = 1)
### Res 3
R3.mat <- t(matrix(c(c1,c2),nrow = p, ncol = 2))
r3.vec <- matrix(c(6.5,0.5),nrow = 2, ncol = 1)
### Res 4
R4.mat = diag(1,p,p)[-p.active,]
r4.vec <- matrix(rep(0,p-length(p.active)),nrow = p-length(p.active), ncol = 1)

n = 100
X = matrix(rnorm(n*p),n,p)
y = X%*%beta + rnorm(n) 

######## Model 1 based on first restrictions
model1 <- rbridge(X, y, q = 1, R1.mat, r1.vec)
print(model1)

######## Model 2 based on second restrictions
model2 <- rbridge(X, y, q = 1, R2.mat, r2.vec)
print(model2)

######## Model 3 based on third restrictions
model3 <- rbridge(X, y, q = 1, R3.mat, r3.vec)
print(model3)

######## Model 4 based on fourth restrictions
model4 <- rbridge(X, y, q = 1, R4.mat, r4.vec)
print(model4)

# }

Run the code above in your browser using DataLab