predict_lasso: Predict responses

Description Usage Arguments Value Examples

View source: R/predictor.R

Description

Predict responses

Usage

1
predict_lasso(fit, newx, s = NULL, type = "response")

Arguments

fit

IILasso model

newx

matrix of explanatory variables

s

selected lambda (default: all)

type

prediction type for logistic lasso: "response" (default) or "class"

Value

prediction matrix (if s is NULL) or vector (if s is specified)

Examples

1
2
3
4
5
6
7
X <- matrix(c(1,2,3,5,4,7,6,8,9,10), nrow=5, ncol=2)
b <- matrix(c(-1,1), nrow=2, ncol=1)
e <- matrix(c(0,-0.1,0.1,-0.1,0.1), nrow=5, ncol=1)
y <- as.numeric(X %*% b + e)
fit <- lasso(X, y)
pr <- predict_lasso(fit, X)
plot_lasso(fit)

iilasso documentation built on May 2, 2019, 10:14 a.m.