predict.starnet {starnet}R Documentation

Makes Predictions

Description

Predicts outcome from features with stacked model.

Usage

## S3 method for class 'starnet'
predict(object, newx, type = "response", nzero = NULL, ...)

Arguments

object

starnet object

newx

covariates: numeric matrix with n rows (samples) and p columns (variables)

type

character "link" or "response"

nzero

maximum number of non-zero coefficients: positive integer, or NULL

...

further arguments (not applicable)

Value

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).

Examples



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])


[Package starnet version 0.0.6 Index]