Last chance! 50% off unlimited learning
Sale ends in
Extract coefficients from a 'bridge' object.
# S3 method for bridge
coef(object, s = c("lambda.1se", "lambda.min"), ...)
A 'bridge' object.
Value(s) of the penalty parameter lambda at which predictions are required.
Additional arguments for compatibility.
A vector of coefficients
# 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)
n = 100
X = matrix(rnorm(n*p),n,p)
y = X%*%beta + rnorm(n)
model1 <- bridge(X, y, q = 1)
coef(model1,s='lambda.min')
# }
Run the code above in your browser using DataLab