Learn R Programming

picasso (version 2.0.1)

predict.logit: Prediction Method for an Object with S3 Class "logit"

Description

Predict responses for new data using fitted models.

Usage

# S3 method for logit
predict(object, newdata, lambda.idx = NULL, p.pred.idx = NULL,
  type = "response", s = NULL, newoffset = NULL, ...)

Value

Return type depends on type:

  • "response" (default): numeric matrix of predicted probabilities \(\hat{p} = \sigma(o_{new} + \hat{\beta}_0 + X \hat{\beta})\).

  • "link": numeric matrix of log-odds \(o_{new} + \hat{\beta}_0 + X \hat{\beta}\).

  • "class": integer matrix of predicted class labels (0 or 1).

  • "nonzero": list of integer vectors of nonzero coefficient indices, one element per selected lambda.

Rows correspond to observations; columns correspond to lambda.idx (or s values when s is specified).

Arguments

object

An object with S3 class "logit".

newdata

Nonempty finite numeric matrix of new observations for prediction (\(n_{new} \times d\)) with the same number of columns as the fitted design.

lambda.idx

Positive integer indices of regularization parameters along the solution path used for prediction. By default, at most the first three fitted path points are used.

p.pred.idx

Optional row indices to subset returned predictions. NULL returns every prediction row.

type

Type of prediction. "response" (default) returns probabilities; "link" returns the log-odds; "class" returns 1 when the link-scale score is positive and 0 otherwise; "nonzero" returns nonzero variable indices.

s

Optional nonempty vector of finite non-negative lambda values; see predict.gaussian.

newoffset

Optional finite numeric vector with one offset per row of newdata. It is required for response, link, or class prediction when object was fitted with offset; type = "nonzero" does not use it. For a model fitted without offset, the default is a vector of zeros.

...

Arguments to be passed to methods.

Author

Jason Ge, Xingguo Li, Haoming Jiang, Mengdi Wang, Tong Zhang, Han Liu and Tuo Zhao
Maintainer: Tuo Zhao <tourzhao@gatech.edu>

Details

predict.logit returns predicted Bernoulli probabilities for newdata using fitted coefficients from object: $$ \hat{p} = \frac{e^{o_{new} + \hat{\beta}_0 + X_{new} \hat{\beta}}}{1+e^{o_{new} + \hat{\beta}_0 + X_{new} \hat{\beta}}}. $$

See Also

picasso and picasso-package.