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

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

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

1
2
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

Dynamic.Ridge 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.

Note

The function at the current form cannot handle missing values. The user has to take prior action with missing values before using this function.

Author(s)

Aris Perperoglou

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
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

Example output

Loading required package: survival
Loading required package: splines
call:
Dynamic.Ridge(time = rfst, death = cens, X = cbind(X, R), Ft = Ft, 
    lambda = 100, fun = "simple", lambdaFixed = TRUE)

                  coef exp(coef)
age            -0.0243    0.9760
grade           0.1532    1.1656
tumsize         0.0864    1.0902
posnodal        0.2220    1.2485
prm            -0.2206    0.8020
esm            -0.0292    0.9712
age:f1(t)       0.0042    1.0042
grade:f1(t)     0.0141    1.0142
tumsize:f1(t)   0.0194    1.0195
posnodal:f1(t)  0.0648    1.0669
prm:f1(t)      -0.0698    0.9326
esm:f1(t)       0.0234    1.0237
age:f2(t)       0.0543    1.0558
grade:f2(t)    -0.0305    0.9700
tumsize:f2(t)  -0.0006    0.9994
posnodal:f2(t)  0.0431    1.0440
prm:f2(t)      -0.0171    0.9830
esm:f2(t)       0.0300    1.0304
age:f3(t)       0.0403    1.0411
grade:f3(t)    -0.0094    0.9906
tumsize:f3(t)   0.0019    1.0019
posnodal:f3(t)  0.0262    1.0265
prm:f3(t)      -0.0030    0.9970
esm:f3(t)       0.0120    1.0121

penalized log-likelihood=  -1750.629
Optimal penalty weight=  100 (converged in 1 internal iterations)
Algorithm converged in 6 iterationsiteration 1 . Penalty weight= 324.1995 
iteration 2 . Penalty weight= 324.2292 
iteration 3 . Penalty weight= 324.2336 
iteration 4 . Penalty weight= 324.2342 
iteration 5 . Penalty weight= 324.2343 
iteration 6 . Penalty weight= 324.2344 
iteration 7 . Penalty weight= 324.2344 
call:
Dynamic.Ridge(time = rfst, death = cens, X = cbind(X, R), Ft = Ft, 
    lambda = 324, fun = "weighted", theta = fit.dr$theta, mon = TRUE)

                  coef exp(coef)
age            -0.2812    0.7549
grade           0.6391    1.8949
tumsize         0.1618    1.1756
posnodal        0.2321    1.2612
prm            -0.2735    0.7607
esm            -0.4971    0.6083
age:f1(t)       0.5399    1.7158
grade:f1(t)    -1.1958    0.3025
tumsize:f1(t)  -0.1495    0.8611
posnodal:f1(t)  0.0252    1.0255
prm:f1(t)       0.0997    1.1049
esm:f1(t)       1.2412    3.4598
age:f2(t)       0.2668    1.3058
grade:f2(t)    -0.2606    0.7706
tumsize:f2(t)  -0.0905    0.9135
posnodal:f2(t) -0.2050    0.8147
prm:f2(t)       0.3089    1.3620
esm:f2(t)      -0.0579    0.9438
age:f3(t)       0.3112    1.3651
grade:f3(t)    -0.7451    0.4747
tumsize:f3(t)  -0.1742    0.8401
posnodal:f3(t) -0.2253    0.7983
prm:f3(t)       0.2608    1.2979
esm:f3(t)       0.6838    1.9815

penalized log-likelihood=  -1749.441
Optimal penalty weight=  324.2344 (converged in 7 internal iterations)
Algorithm converged in 20 iterationscall:
Dynamic.Ridge(time = rfst, death = cens, X = X, R = R, Ft = Ft, 
    lambda = 150, fun = "simple", lambdaFixed = TRUE)

               coef exp(coef)
age         -0.0232    0.9770
grade        0.1132    1.1199
age:f1(t)    0.0003    1.0003
grade:f1(t)  0.0130    1.0131
age:f2(t)    0.0385    1.0393
grade:f2(t) -0.0175    0.9826
age:f3(t)    0.0292    1.0296
grade:f3(t) -0.0044    0.9957
tumsize      0.1056    1.1114
posnodal     0.2774    1.3197
prm         -0.4908    0.6121
esm          0.0135    1.0136

penalized log-likelihood=  -1798.451
Optimal penalty weight=  150 (converged in 1 internal iterations)
Algorithm converged in 7 iterations

CoxRidge documentation built on May 1, 2019, 8:48 p.m.