[R] time dependency of Cox regression
Thomas Lumley
tlumley at u.washington.edu
Wed Nov 3 17:24:20 CET 2004
> array chip wrote:
>> Hi,
>>
>> How can I specify a Cox proportional hazards model
>> with a covariate which i believe its strength on
>> survival changes/diminishes with time? The value of
>> the covariate was only recorded once at the beginning
>> of the study for each individual (e.g. at the
>> diagnosis of the disease), so I do not have the time
>> course data of the covariate for any given individual.
>> For example, I want to state at the end of the
>> analysis that the hazard ratio of the covariate is 6
>> at the beginning, decrease to 3 after 2 years and
>> decrease to 1.5 after 5 years.
If you fit a Cox model with the fixed covariate, plot(cox.zph(model)) will
show you an estimate of how the log hazard ratio changes over time, with
pointwise confidence intervals.
If you want more precise estimates and confidence intervals you can split
up your covariate into a set of time-dependent covariates.
If you wanted a time period for each year up to 6 years you would make 6
time dependent covariates, looking like
x 0 0 0 0 0
0 x 0 0 0 0
0 0 x 0 0 0
0 0 0 x 0 0
0 0 0 0 x 0
0 0 0 0 0 x
and have (up to) six records per person. The survSplit() function in the
survival package will do the splitting, you then need to set the
appropriate terms to zero and fit the model.
-thomas
More information about the R-help
mailing list