Function to compute the linear predictor from a coxUniv fit

Share:

Description

Function to compute the linear predictor from a coxUniv fit

Usage

1
predict.uniCox(object,x,...)

Arguments

object

Object returned by uniCox

x

Feature matrix, n obs by p variables

...

Included for compatibility with generic predict function

Details

This function compute the linear predictor from a coxUniv fit for a set of test features

Value

A matrix of dimension (number rows of x) by ( number of lambda values), representing the predictions x

Source

Tibshirani, R. Univariate shrinkage in the Cox model for high dimensional data (2009). http://www-stat.stanford.edu/~tibs/ftp/cus.pdf To appear SAGMB.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
library(survival)
# generate some data
x=matrix(rnorm(200*1000),ncol=1000)
y=abs(rnorm(200))
x[y>median(y),1:50]=x[y>median(y),1:50]+3
status=sample(c(0,1),size=200,replace=TRUE)

xtest=matrix(rnorm(50*1000),ncol=1000)
ytest=abs(rnorm(50))
xtest[ytest>median(ytest),1:50]=xtest[ytest>median(ytest),1:50]+3

statustest=sample(c(0,1),size=50,replace=TRUE)


# fit model
a=uniCox(x,y,status)

# get predictions on a test set
yhat=predict.uniCox(a,xtest)

# fit survival model to predicted values for 7th val of lambda
coxph(Surv(ytest,statustest)~yhat[,7])