predict.islasso {islasso} | R Documentation |
Prediction method for islasso fitted objects
Description
Prediction method for islasso fitted objects
Usage
## S3 method for class 'islasso'
predict(object, newdata = NULL,
type = c("link", "response", "coefficients", "class", "terms"),
se.fit = FALSE, ci = NULL, type.ci = "wald",
level = .95, terms = NULL, na.action = na.pass, ...)
Arguments
object |
a fitted object of class "islasso". |
newdata |
optionally, a data frame in which to look for variables with which to predict. If omitted, the fitted linear predictors are used. |
type |
the type of prediction required. The default is on the scale of the linear predictors; the alternative "response" is on the scale of the response variable.
Thus for a default binomial model the default predictions are of log-odds (probabilities on logit scale) and type = "response" gives the predicted probabilities. The |
se.fit |
logical switch indicating if confidence intervals are required. |
ci |
optionally, a two columns matrix of estimated confidence intervals for the estimated coefficients. |
type.ci |
Only Wald-type confidence intervals are implemented yet! type.ci = "wald" estimates and standard errors are used to build confidence interval |
level |
the confidence level required. |
terms |
with type = "terms" by default all terms are returned. A character vector specifies which terms are to be returned. |
na.action |
function determining what should be done with missing values in newdata. The default is to predict NA. |
... |
further arguments passed to or from other methods. |
Value
An object depending on the type argument
Author(s)
Maintainer: Gianluca Sottile <gianluca.sottile@unipa.it>
See Also
islasso.fit
, summary.islasso
, residuals.islasso
, logLik.islasso
, predict.islasso
and deviance.islasso
methods.
Examples
set.seed(1)
n <- 100
p <- 100
p1 <- 20 #number of nonzero coefficients
coef.veri <- sort(round(c(seq(.5, 3, l=p1/2), seq(-1, -2, l=p1/2)), 2))
sigma <- 1
coef <- c(coef.veri, rep(0, p-p1))
X <- matrix(rnorm(n*p), n, p)
mu <- drop(X%*%coef)
y <- mu + rnorm(n, 0,sigma)
lambda <- 2
o <- islasso(y ~ ., data = data.frame(y = y, X), lambda = lambda)
predict(o, type = "response")