predict.glmpath: Makes predictions at particular points along the fitted...

Description Usage Arguments Author(s) References See Also Examples

View source: R/glmpath.97.R

Description

This function makes predictions at particular points along the fitted glmpath. The linear predictor, estimated response, log-likelihood, or the coefficients can be computed.

Usage

1
2
3
4
5
6
  ## S3 method for class 'glmpath'
predict(object, newx, newy, s, type = c("link", "response",
        "loglik", "coefficients"), mode = c("step",
        "norm.fraction", "norm", "lambda.fraction", "lambda"),
        weight = NULL, offset = NULL,
        eps = .Machine$double.eps, ...)

Arguments

object

a glmpath object

newx

a matrix of features at which the predictions are made. If type=link, type=response, or type=loglik, newx is required.

newy

a vector of responses corresponding to newx. If type=loglik, newy is required.

s

the values of mode at which the predictions are made. If s is missing, then the steps at which the active set changed are used, and thus, mode is automatically switched to step.

type

If type=link, the linear predictors are returned; if type=response, the estimated responses are returned; if type=loglik, the log-likelihoods are returned, and if type=coefficients, the coefficients are returned. The coefficients for the initial input variables are returned (rather than the standardized coefficients). Default is link.

mode

what mode=s refers to. If mode=step, s is the number of steps taken; if mode=norm.fraction, s is the fraction of the L1 norm of the standardized coefficients (with respect to the largest norm); if mode=norm, s is the L1 norm of the standardized coefficients; if mode=lambda.fraction, s is the fraction of log(λ); and if mode=lambda, s is λ. Default is step.

weight

an optional vector of weights for observations. weight is effective only if type=loglik.

offset

If offset was used in object, offset must be provided for prediction, unless type=coefficients.

eps

an effective zero

...

other options for the prediction

Author(s)

Mee Young Park and Trevor Hastie

References

Mee Young Park and Trevor Hastie (2007) L1 regularization path algorithm for generalized linear models. J. R. Statist. Soc. B, 69, 659-677.

See Also

cv.glmpath, glmpath, plot.glmpath

Examples

1
2
3
4
5
data(heart.data)
attach(heart.data)
fit <- glmpath(x, y, family=binomial)
pred <- predict(fit, x, s = seq(0, 1, length=10), mode="norm.fraction")
detach(heart.data)

Example output

Loading required package: survival

glmpath documentation built on May 2, 2019, 4 p.m.