Learn R Programming

glmpath (version 0.98)

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

Description

This function makes predictions at particular points along the fitted coxpath. The coefficients, log-partial-likelihood, linear predictor or the risk can be computed. A coxph object can be returned at one particular value of \(\lambda.\)

Usage

# S3 method for coxpath
predict(object, data, s, type = c("coefficients", "loglik",
        "lp", "risk", "coxph"), mode = c("step",
        "norm.fraction", "norm", "lambda.fraction", "lambda"),
        eps = .Machine$double.eps, ...)

Arguments

object

a coxpath object

data

a list containing x, time, and status, with which the predictions are made. If type=lp or type=risk, then x is required. If type=loglik or type=coxph, then x, time, and status are required.

s

the values of mode at which the predictions are made. If type=coxph, only the first element of s is used. 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=coefficients, the coefficients are returned; if type=loglik, log-partial-likelihoods are returned; if type=lp, linear predictors (\(x'\beta\)) are returned; if type=risk, risks (\(e^{x'\beta}\)) are returned; and if type=coxph, a coxph object (as in survival package) at the first element of s is returned. (i.e. the components of a coxph object such as coefficients, variance, and the test statistics are adjusted to the shrinkage corresponding to s. A coxph object can be further used as an argument to the functions in survival package.) Default is coefficients. The coefficients for the initial input variables are returned (rather than the standardized coefficients).

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(\(\lambda\)); and if mode=lambda, s is \(\lambda\). Default is step.

eps

an effective zero

...

other options for the prediction

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.coxpath, coxpath, plot.coxpath

Examples

Run this code
# NOT RUN {
data(lung.data)
attach(lung.data)
fit <- coxpath(lung.data)
pred.a <- predict(fit, x, s = seq(0, 1, length=10),
                  mode = "norm.fraction")
library(survival)
pred.b <- predict(fit, lung.data, s = 0.5, type = "coxph",
                  mode = "lambda.fraction")
pred.s <- survfit(pred.b)
plot(pred.s)
detach(lung.data)
# }

Run the code above in your browser using DataLab