predict.starnet {starnet} | R Documentation |
Predicts outcome from features with stacked model.
## S3 method for class 'starnet'
predict(object, newx, type = "response", nzero = NULL, ...)
object |
starnet object |
newx |
covariates:
numeric matrix with |
type |
character "link" or "response" |
nzero |
maximum number of non-zero coefficients:
positive integer, or |
... |
further arguments (not applicable) |
Matrix of predicted values, with samples in the rows,
and models in the columns. Included models are
alpha
(fixed elastic net),
ridge
(i.e. alpha0
),
lasso
(i.e. alpha1
),
tune
(tuned elastic net),
stack
(stacked elastic net),
and none
(intercept-only model).
set.seed(1)
n <- 50; p <- 100
y <- rnorm(n=n)
X <- matrix(rnorm(n*p),nrow=n,ncol=p)
object <- starnet(y=y,X=X)
y_hat <- predict(object,newx=X[c(1),,drop=FALSE])