Learn R Programming

CoxRidge (version 0.9.2)

Dynamic.Ridge: Fit a Cox model with time dependent effects of the covariates and penalized likelihood.

Description

Fits a Cox model on which some, or all, of the covariates are allowed to have time varying effects. The likelihood is penalized either using a simple ridge penalty on all time varying covariates ("simple") or a dynamic ridge penalty ("dynamic") which includes the used time functions in the penalty. There is also the option for a "weighted" ridge penalty based on the baseline hazard.

Usage

Dynamic.Ridge(time, death, X, R, Ft, lambda = 0, fun = c("dynamic", "weighted","simple"), eps = 1e-06, iter.max = 200, theta, mon = FALSE, lambdaFixed = FALSE)

Arguments

time
a vector containing failure/censoring times.
death
a vector containing the status indicator.
X
a matrix of time varying covariates.
R
an optional matrix of time fixed covariates. When R is missing then all covariates are assumed to be time varying.
Ft
a matrix containing the time functions. The first column must be constant.
lambda
When lambdaFixed is FALSE lambda is a scalar giving the starting value for the weight of the penalty. When lambdaFixed is true lambda is the chosen weight of the penalty.
fun
"simple", "dynamic", or "weigthed": types of penalty.
eps
a small value. The criterion of convergance.
iter.max
maximum number of iterations, default is 200.
theta
an optional matrix of starting values for coefficients of time varying effects.
mon
when true the function prints out the computed lambda weigh in each iteration.
lambdaFixed
when TRUE the function does not seek to optimize the penalty weight.

Value

returns an object of class "cox.dynamic.ridge" The function print.cox.dynamic.ridge is used to obtain and print a summary of the results. An object of class "cox.dynamic.ridge" is a list containing some the following components:
call
function call.
theta
a matrix of coefficient for the covariates with time varying effects.
fixed.coef
the vector of fixed effects coefficients.
loglik
the penalized log-likelihood of the model.
time
a vector with failure/censoring times.
death
a vector of status indicator.
X
the matrix of time varying covariates.
R
the matrix of fixed covariates.
Ft
the matrix of time functions
iter
number of iterations used to maximise likelihood at a fixed lambda.
inter.it
number of iterations used to find optimal lambda.'
lambda
optimal weight of the penalty.
Hat
the hat matrix at convergance.
h2
the non-penalized Hessian matrix of second derivatives.

References

Perperoglou A.(2013)Cox models with dynamic ridge penalties on time varying effects of the covariates. Statistics in Medicine, to appear

See Also

coxph, cox.ridge

Examples

Run this code
data(GBSG)
attach(GBSG)
X <- cbind(age,grade)
R <- cbind(tumsize,posnodal,prm,esm)
X <- apply(X,2,function(x){(x-mean(x))/sqrt(var(x))}) #standardize covariates
R <- apply(R,2,function(x){(x-mean(x))/sqrt(var(x))}) #standardize covariates
Ft <- cbind(rep(1,nrow(X)),bs(rfst))

# a model with all covariates as time varying, simple penalty
fit.dr <- Dynamic.Ridge(rfst,cens,cbind(X,R),Ft=Ft,lambda=100,fun="simple",lambdaFixed=TRUE)
fit.dr  #regression coefficients correspond to the standardized covariates

# a model with all covariates as time varying, weighted penalty
fit.wdr <- Dynamic.Ridge(rfst,cens,cbind(X,R),Ft=Ft,lambda=324,theta=fit.dr$theta,
fun="weighted",mon=TRUE)
fit.wdr #regression coefficients correspond to the standardized covariates

# a model with fixed and time varying covariates
fit.dr <- Dynamic.Ridge(rfst,cens,X,R,Ft,lambda=150,fun="simple",lambdaFixed=TRUE)
fit.dr

Run the code above in your browser using DataLab