predict.rbridge {rbridge} | R Documentation |
Make predictions from a 'rbridge' object
Description
Makes predictions from a cross-validated 'rbridge' model
Usage
## S3 method for class 'rbridge'
predict(object, newx, s = c("lambda.min",
"lambda.1se"), type = c("response", "nonzero", "coefficients"), ...)
Arguments
object |
A 'rbridge' object. |
newx |
Matrix of new values for x at which predictions are to be made. |
s |
Value(s) of the penalty parameter lambda at which predictions are required. |
type |
It should one of "response", "nonzero" or "coefficients". The "response" is for predicted values, the "nonzero" is for exacting non-zero coefficients and the "coefficients" is for the estimated coefficients. |
... |
Additional arguments for compatibility. |
Value
Among a matrix with predictions, a vector non-zero indexing or a vector of coefficients
Author(s)
Bahadir Yuzbasi, Mohammad Arashi and Fikri Akdeniz
Maintainer: Bahadir Yuzbasi b.yzb@hotmail.com
See Also
Examples
set.seed(2019)
beta <- c(3, 1.5, 0, 0, 2, 0, 0, 0)
p <- length(beta)
beta <- matrix(beta, nrow = p, ncol = 1)
### Restricted Matrix and vector
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)
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)
predict(model1,newx=X[1:5,], s="lambda.min", type="response")
predict(model1, s="lambda.min",type="coefficient")
[Package rbridge version 1.0.2 Index]