R code for computing variable importance for a survival model

The following R code computes the relative importance for predictor variables in a survival model. The implemented method for computing the relative importance was inspired by the Leo Breiman’s method for computing variable importance in a Random Forest.

Breiman’s method for computing variable importance can best be explained with an example.
Suppose you have 5 predictor variables, say x1 to x5. These 5 variables are used for predicting some observed response y. However, the 5 variables do not predict exactly the observed values for y. In other words, the predictions based on the 5 variables will more or less deviate from the observed values for y. The Mean Squared Error (MSE) is calculated as the mean of these deviations.
Assume now that predictor x1 has no predictive value for the response y. Hence, if we would randomly permute the observed values for x1, then our predictions for y would hardly change. As a consequence, the MSE before and after permuting the observed values for x1 would be similar.
On the other hand, assume that x3 is strongly related to our response y. If we randomly permute the observed values for x3, then our MSE before and after this permutation would deviate considerably.
Based on these random permutations and our observed change in MSE, we may conclude that predictor variable x3 is more important than x1 in predicting y.

The R code below applies Breiman’s permutation method for computing the relative importance of predictor variables to a survival model. However, instead of MSE the code employs concordance as a measure for the prediction accuracy.
Furthermore, the R code also compares in 2 simulations the performance of Breiman’s method applied to survival models with that of Breiman’s method implemented in a random survival forest.

survival model variable importance

Continue reading R code for computing variable importance for a survival model

R code for fitting an Accelerated Life Test Model

The following code may be used for fitting an accelerated life test model in R.

Currently the R code implements the lognormal and Weibull distribution for failure times. However, the code can be easily adapted to implement other distributions as well (such as the Gumbel distribution).

accelerated life test model

As an example, temperature (on the Arrhenius scale) is used as acceleration factor in the code. But it also possible to use other acceleration factors (for instance, voltage stress). Moreover, the code can be extended to include multiple accelerators in the accelerated life test model, and even their interaction.

Continue reading R code for fitting an Accelerated Life Test Model