predict-grpsurv: Model predictions based on a fitted "grpsurv" object.

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Similar to other predict methods, this function returns predictions from a fitted "grpsurv" object.

Usage

1
2
3
4
## S3 method for class 'grpsurv'
predict(object, X, type=c("link", "response", "survival",
"median", "norm", "coefficients", "vars", "nvars", "groups", "ngroups"),
lambda, which=1:length(object$lambda), ...)

Arguments

object

Fitted "grpsurv" model object.

X

Matrix of values at which predictions are to be made. Not used for type="coefficients" or for some of the type settings in predict.

lambda

Values of the regularization parameter lambda at which predictions are requested. For values of lambda not in the sequence of fitted models, linear interpolation is used.

which

Indices of the penalty parameter lambda at which predictions are required. By default, all indices are returned. If lambda is specified, this will override which.

type

Type of prediction: "link" returns the linear predictors; "response" gives the risk (i.e., exp(link)); "survival" returns the estimated survival function; "median" estimates median survival times. The other options are all identical to their grpreg counterparts: "coefficients" returns the coefficients; "vars" returns the indices for the nonzero coefficients; "groups" returns the indices for the groups with at least one nonzero coefficient; "nvars" returns the number of nonzero coefficients; "ngroups" returns the number of groups with at least one nonzero coefficient; "norm" returns the L2 norm of the coefficients in each group.

...

Not used.

Details

Estimation of baseline survival function conditional on the estimated values of beta is carried out according to the method described in Chapter 4.3 of Kalbfleish and Prentice. In particular, it agrees exactly with the results returned by survfit.coxph(..., type='kalbfleisch-prentice') in the survival package.

Value

The object returned depends on type.

Author(s)

Patrick Breheny

References

See Also

grpsurv

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
data(Lung)
X <- Lung$X
y <- Lung$y
group <- Lung$group

fit <- grpsurv(X, y, group)
coef(fit, lambda=0.05)
head(predict(fit, X, type="link", lambda=0.05))
head(predict(fit, X, type="response", lambda=0.05))

# Survival function
S <- predict(fit, X[1,], type="survival", lambda=0.05)
S(100)
S <- predict(fit, X, type="survival", lambda=0.05)
plot(S, xlim=c(0,200))

# Medians
predict(fit, X[1,], type="median", lambda=0.05)
M <- predict(fit, X, type="median")
M[1:10, 1:10]

# Nonzero coefficients
predict(fit, type="vars", lambda=c(0.1, 0.01))
predict(fit, type="nvars", lambda=c(0.1, 0.01))

Example output

Loading required package: Matrix
        trt      karno1      karno2      karno3   diagtime1   diagtime2 
 0.07652935 -6.19181104  0.78945438 -0.46953841  0.00000000  0.00000000 
       age1        age2        age3       prior    squamous       small 
-0.29895766  0.29905276 -0.98300604  0.00000000 -0.37016343  0.16503970 
      adeno       large 
 0.38628145 -0.17872796 
         1          2          3          4          5          6 
-0.3587509 -0.5741486 -0.2395230 -0.3704099 -0.5685743  0.8096858 
        1         2         3         4         5         6 
0.6985484 0.5631842 0.7870032 0.6904512 0.5663323 2.2472019 
[1] 0.5094304
[1] 103
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]   80   80   80   73   73   73   73   80   82    87
 [2,]   80   80   80   82   82   84   87   92   95    99
 [3,]   80   80   80   73   73   73   73   80   82    87
 [4,]   80   80   80   73   73   73   73   80   82    87
 [5,]   80   80   80   82   82   84   87   92   95    99
 [6,]   80   61   54   52   49   44   36   35   33    31
 [7,]   80   72   61   59   54   53   52   53   53    54
 [8,]   80   82   87   90   92   95   99  100  105   111
 [9,]   80   73   72   63   61   59   59   61   63    72
[10,]   80   80   80   82   82   84   87   92   95    99
$`0.1`
  karno1   karno2   karno3 squamous    small    adeno    large 
       2        3        4       11       12       13       14 

$`0.01`
      trt    karno1    karno2    karno3 diagtime1 diagtime2      age1      age2 
        1         2         3         4         5         6         7         8 
     age3     prior  squamous     small     adeno     large 
        9        10        11        12        13        14 

 0.1 0.01 
   7   14 

grpreg documentation built on Sept. 27, 2018, 5:03 p.m.