cox.tvc: Test for a time-varying effect in the 'coxph' model

View source: R/tvc.coxph.R

cox.tvcR Documentation

Test for a time-varying effect in the coxph model

Description

Test for a time-varying effect in the coxph model by re-fitting the partial likelihood including a time-varying effect, plot the effect size, and return the re-fitted model. The main advantage of this function over the tt() special is that it scales well for moderate sized datasets (cf. tt which expands the dataset and scales very poorly).

Usage

cox.tvc(obj, var=NULL, method="logt")

Arguments

obj

A coxph object. Currently restricted to right censoring with Breslow ties and without stratification, etc.

var

String for the effect name. Currently assumes simple continuous effects.

method

A string representing the possible time transformations. Currently only "logt".

Value

Returns a tvcCoxph object (which inherits from the mle2 class) of the re-fitted model.

See Also

coxph, cox.zph

Examples

## As per the example for cox.zph:
fit <- coxph(Surv(futime, fustat) ~ age + ecog.ps,  
             data=ovarian) 
temp <- rstpm2:::cox.tvc(fit, "age") 
print(temp)                  # display the results 
plot(temp)                   # plot curves 

rstpm2 documentation built on Oct. 29, 2024, 5:06 p.m.