uniCox (version 1.0)

uniCox: Function to fit a high dimensional Cox survival model using Univariate Shrinkage

Description

Function to fit a high dimensional Cox survival model using Univariate Shrinkage

Usage

uniCox(x,y,status,lamlist=NULL,nlam=20,del.thres=.01, max.iter=5)

Arguments

x
Feature matrix, n obs by p variables
y
Vector of n survival times
status
Vector of n censoring indicators (1= died or event occurred,0=survived, or event was censored)
lamlist
Optional vector of lambda values for solution path
nlam
Number of lambda values to consider
del.thres
Convergence threshold
max.iter
Maximum number of iterations for each lambda

Value

A list with components
lamlist
Values of lambda used
beta
Coef estimates, number of features by number of lambda values
mx
Mean of feature columns
vx
Square root of Fisher information for each feature
s0
Exchangeability factor for denominator of score statistic
call
Call to this function

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.

Details

This function builds a prediction model for survival data with high-dimensional covariates, using the Unvariate Shringae method.

Examples

Run this code
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 uniCox  model
a=uniCox(x,y,status)

# look at results
 print(a)

# do cross-validation to examine choice of lambda
aa=uniCoxCV(a,x,y,status)

# look at results
 print(aa)

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

# fit survival model to predicted values
coxph(Surv(ytest,statustest)~yhat[,7])

Run the code above in your browser using DataCamp Workspace