predict.glmpath {glmpath} | R Documentation |
This function makes predictions at particular points along the fitted
glmpath.
The linear predictor, estimated response,
log-likelihood, or the coefficients can be computed.
predict.glmpath(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, ...)
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 |
Mee Young Park and Trevor Hastie
Mee Young Park and Trevor Hastie (2007) L1 regularization path algorithm for generalized linear models. J. R. Statist. Soc. B, 69, 659-677.
cv.glmpath, glmpath, plot.glmpath
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)