This R package implements several approaches to fitting the additive hazards model. Besides the traditional Aalen’s method, this package also offers the maximum likelihood methods to fit the model.
Given the survival variable (survival times and censors) and corresponding indpendent variables, the package offers the function
ah which fits the coefficients of the independent variables as a step funtion of time by the choosing method.
For details, see: Maximum likelihood estimation in the additive hazards model(2021).
By default, the package do not assume the range of the independent varaibles. However, for the maximum likelihood method, it will automatically take the maximum value and minimum value in the data as the range of the independent variable. If you do not want this setting – for example, you already know the ranges of the varialbes – please rearange the value of indpendent variables between \([0,1]\) by linear transformation and put the argument
scale to be FALSE. You can calculate the true coefficients of the original data by the inverse of the former linear transformation manually.
When you use the maximum likelihood method with the default domain (the full domain which assures all hazard to be positive), we recommand you to use the optimial method given by the parameter
ml_opt, which is also the default method. If you want to input your own domain matrix, the descending method given by the parameter
ml_desc is recommanded. In this case, the comsuming time is very sensitive to the number of rows of the domain matrix. If you have very large number of domains (say more than \(100\)), it will comsume quite a lot of time.
ahMLE is available on CRAN and can be installed as follows in an R session:
Once installed, the package can be loaded in a given R session using:
We apply the method to the data from a clinical trial with 195 patients with carcinoma of the oropharynx by the Radiation Therapy Oncology Group in the United States. Patients were randomised into two treatment groups (“standard” and “experimental” treatment), and survival times were measured in days from diagnosis. Seven covariates were included in the data: Sex, Treatment, Grade, Age, Condition, T-stage and N-stage. The data is originally stored in the package
invGauss(which is unforuntately out of update).
In our analysis, we take all the covariates as continuous. We re-scale them to \([0,1]\).
require(survival) require(invGauss) library(ahMLE) data(d.oropha.rec) = data.frame(time = d.oropha.rec$time, SData constant = 1, sex = d.oropha.rec$sex, treatm = d.oropha.rec$treatm, grade = d.oropha.rec$grade, age = d.oropha.rec$age, cond = d.oropha.rec$cond, tstage = d.oropha.rec$tstage, nstage = d.oropha.rec$nstage, event = d.oropha.rec$status) # Data rescaled $sex = SData$sex - 1 SData$treatm = SData$treatm -1 SData$grade = SData$grade -1 SData$age = (SData$age -60)/10 SData$cond = SData$cond -1 SData$tstage = SData$tstage - 1SData
With the data rescaled, we can fit the data with two methods, the Aalen’s OLS method and the maximum likelihood method.
= Surv(time= time, event = event) ~ sex + treatm +grade + age +cond + tstage + nstage formula_input # Use Aalen's OLS method to compute the cumulative beta = ah(formula_input, data = SData, method = "aalen") beta_aalen = beta_aalen$cumbeta Cbeta_aalen # Use (default) maximum likelihood method to compute the cumulative beta = ah(formula_input, data = SData, progbar = TRUE) beta_mle= beta_mle$cumbetaCbeta_mle
We illustrate the cumulative beta estimated by two methods for the additive hazards model.
<- par(no.readonly = TRUE) old.par par(mfrow=c(1,1)) par(mar=c(5, 6, 4, 2)) = beta_aalen$cumbeta[,1] time_grid plot(time_grid,Cbeta_mle[,2],type="l", lwd = 2, col=colors(), ylim=c(-0.1,1.1), ylab = "Cumulative beta",xlab = "Days from diagnosis", cex.lab=1) lines(time_grid,Cbeta_aalen[,2], type="l", lty = 5, lwd =2, col="red") legend("topright", legend=c("MLE","OLS"), col=c(colors(),"red"),lty=c(1,5), cex=1,lwd = 1)
The project is sponsored by the Leiden University Fund / Hakkenberg \(\alpha\) \(\beta\) \(\gamma\)-integratie Fonds, www.luf.xn–nl-02t. We would like to thank and acknowledge their support.
We acknowledge the authors of the package
invGauss for importing their clinical data of carcinoma of the oropharynx.