Learn R Programming

timereg (version 1.8.6)

cox.aalen: Fit Cox-Aalen survival model

Description

Fits an Cox-Aalen survival model. Time dependent variables and counting process data (multiple events per subject) are possible.

$$\lambda_{i}(t) = Y_i(t) ( X_{i}^T(t) \alpha(t) ) \exp(Z_{i}^T \beta )$$

The model thus contains the Cox's regression model as special case.

To fit a stratified Cox model it is important to parametrize the baseline apppropriately (see example below).

Resampling is used for computing p-values for tests of time-varying effects. Test for proportionality is considered by considering the score processes for the proportional effects of model.

The modelling formula uses the standard survival modelling given in the survival package.

Usage

cox.aalen(formula=formula(data),data=sys.parent(),beta=NULL,Nit=20,detail=0,
start.time=0,max.time=NULL,id=NULL,clusters=NULL,n.sim=500,residuals=0,
robust=1,weighted.test=0,covariance=0,resample.iid=1,weights=NULL,rate.sim=1,
beta.fixed=0,max.clust=1000,exact.deriv=1,silent=1,max.timepoint.sim=100,
basesim=0,offsets=NULL,strata=NULL)

Arguments

formula
a formula object with the response on the left of a '~' operator, and the independent terms on the right as regressors. The response must be a survival object as returned by the `Surv' function. Terms with a proportional effect are specified by the
data
a data.frame with the variables.
start.time
start of observation period where estimates are computed.
max.time
end of observation period where estimates are computed. Estimates thus computed from [start.time, max.time]. Default is max of data.
robust
to compute robust variances and construct processes for resampling. May be set to 0 to save memory and time, in particular for rate.sim=1.
id
For timevarying covariates the variable must associate each record with the id of a subject.
clusters
cluster variable for computation of robust variances.
n.sim
number of simulations in resampling.
weighted.test
to compute a variance weighted version of the test-processes used for testing time-varying effects.
residuals
to returns residuals that can be used for model validation in the function cum.residuals. Estimated martingale increments (dM) and corresponding time vector (time). When rate.sim=1 returns estimated martingales, dM_i(t) and if rate.sim=0, returns a matrix
covariance
to compute covariance estimates for nonparametric terms rather than just the variances.
resample.iid
to return i.i.d. representation for nonparametric and parametric terms. based on counting process or martingale resduals (rate.sim).
beta
starting value for relative risk estimates.
Nit
number of iterations for Newton-Raphson algorithm.
detail
if 0 no details is printed during iterations, if 1 details are given.
weights
weights for weighted analysis.
rate.sim
rate.sim=1 such that resampling of residuals is based on estimated martingales and thus valid in rate case, rate.sim=0 means that resampling is based on counting processes and thus only valid in intensity case.
beta.fixed
option for computing score process for fixed relative risk parameter
max.clust
sets the total number of i.i.d. terms in i.i.d. decompostition. This can limit the amount of memory used by coarsening the clusters. When NULL then all clusters are used. Default is 1000 to save memory and time.
exact.deriv
if 1 then uses exact derivative in last iteration, if 2 then uses exact derivate for all iterations, and if 0 then uses approximation for all computations and there may be a small bias in the variance estimates. For Cox model always exact and all optio
silent
if 1 then opppresses some output.
max.timepoint.sim
considers only this resolution on the time scale for simulations, see time.sim.resolution argument
basesim
1 to get simulations for cumulative baseline, including tests for contant effects.
offsets
offsets for analysis on log-scale. RR=exp(offsets+ x beta).
strata
future option for making strata in a different day than through X design in cox-aalen model (~-1+factor(strata)).

Value

  • returns an object of type "cox.aalen". With the following arguments:
  • cumcumulative timevarying regression coefficient estimates are computed within the estimation interval.
  • var.cumthe martingale based pointwise variance estimates.
  • robvar.cumrobust pointwise variances estimates.
  • gammaestimate of parametric components of model.
  • var.gammavariance for gamma.
  • robvar.gammarobust variance for gamma.
  • residualslist with residuals.
  • obs.testBeq0observed absolute value of supremum of cumulative components scaled with the variance.
  • pval.testBeq0p-value for covariate effects based on supremum test.
  • sim.testBeq0resampled supremum values.
  • obs.testBeqCobserved absolute value of supremum of difference between observed cumulative process and estimate under null of constant effect.
  • pval.testBeqCp-value based on resampling.
  • sim.testBeqCresampled supremum values.
  • obs.testBeqC.isobserved integrated squared differences between observed cumulative and estimate under null of constant effect.
  • pval.testBeqC.isp-value based on resampling.
  • sim.testBeqC.isresampled supremum values.
  • conf.bandresampling based constant to construct robust 95% uniform confidence bands.
  • test.procBeqCobserved test-process of difference between observed cumulative process and estimate under null of constant effect over time.
  • sim.test.procBeqClist of 50 random realizations of test-processes under null based on resampling.
  • covariancecovariances for nonparametric terms of model.
  • B.iidResample processes for nonparametric terms of model.
  • gamma.iidResample processes for parametric terms of model.
  • loglikeapproximate log-likelihood for model, similar to Cox's partial likelihood. Only computed when robust=1.
  • D2linvinverse of the derivative of the score function.
  • scorevalue of score for final estimates.
  • test.procPropobserved score process for proportional part of model.
  • var.scorevariance of score process (optional variation estimator for beta.fixed=1 and robust estimator otherwise).
  • pval.Propp-value based on resampling.
  • sim.supPropre-sampled absolute supremum values.
  • sim.test.procProplist of 50 random realizations of test-processes for proportionality under the model based on resampling.

Details

The data for a subject is presented as multiple rows or 'observations', each of which applies to an interval of observation (start, stop]. For counting process data with the )start,stop] notation is used the 'id' variable is needed to identify the records for each subject. The program assumes that there are no ties, and if such are present random noise is added to break the ties.

References

Martinussen and Scheike, Dynamic Regression Models for Survival Data, Springer (2006).

Examples

Run this code
library(timereg)
data(sTRACE)
# Fits Cox model 
out<-cox.aalen(Surv(time,status==9)~prop(age)+prop(sex)+
prop(vf)+prop(chf)+prop(diabetes),data=sTRACE)

# makes Lin, Wei, Ying test for proportionality
summary(out)
par(mfrow=c(2,3))
plot(out,score=1) 

# Fits stratified Cox model 
out<-cox.aalen(Surv(time,status==9)~-1+factor(vf)+ prop(age)+prop(sex)+
	       prop(chf)+prop(diabetes),data=sTRACE,max.time=7,n.sim=100)
summary(out)
par(mfrow=c(1,2)); plot(out); 
# Same model, but needs to invert the entire marix for the aalen part: X(t) 
out<-cox.aalen(Surv(time,status==9)~factor(vf)+ prop(age)+prop(sex)+
	       prop(chf)+prop(diabetes),data=sTRACE,max.time=7,n.sim=100)
summary(out)
par(mfrow=c(1,2)); plot(out); 


# Fits Cox-Aalen model 
out<-cox.aalen(Surv(time,status==9)~prop(age)+prop(sex)+
               vf+chf+prop(diabetes),data=sTRACE,max.time=7,n.sim=100)
summary(out)
par(mfrow=c(2,3))
plot(out)

Run the code above in your browser using DataLab