Learn R Programming

R/riskRegression: Risk Regression Models and Prediction Scores for Survival Analysis with Competing Risks

Implementation of the following methods for event history analysis: Risk regression models for survival endpoints also in the presence of competing risks are fitted using binomial regression based on a time sequence of binary event status variables. A formula interface for the Fine-Gray regression model and an interface for the combination of cause-specific Cox regression models. A toolbox for assessing and comparing performance of risk predictions (risk markers and risk prediction models). Prediction performance is measured by the Brier score and the area under the ROC curve for binary possibly time-dependent outcome. Inverse probability of censoring weighting and pseudo values are used to deal with right censored data. Lists of risk markers and lists of risk models are assessed simultaneously. Cross-validation repeatedly splits the data, trains the risk prediction models on one part of each split and then summarizes and compares the performance across splits.

Installation

library(devtools)
install_github("tagteam/riskRegression")

References

The following references provide the methodological framework for the features of riskRegression.

  1. T.A. Gerds and M.W. Kattan (2021). Medical Risk Prediction Models: With Ties to Machine Learning (1st ed.) Chapman and Hall/CRC https://doi.org/10.1201/9781138384484

  2. T.A. Gerds and M. Schumacher. Consistent estimation of the expected Brier score in general survival models with right-censored event times. Biometrical Journal, 48(6):1029--1040, 2006.

  3. T.A. Gerds and M. Schumacher. Efron-type measures of prediction error for survival analysis. Biometrics, 63(4):1283--1287, 2007.

  4. T.A. Gerds, T. Cai, and M. Schumacher. The performance of risk prediction models. Biometrical Journal, 50(4):457--479, 2008.

  5. U B Mogensen, H. Ishwaran, and T A Gerds. Evaluating random forests for survival analysis using prediction error curves. Journal of Statistical Software, 50(11), 2012.

  6. P. Blanche, J-F Dartigues, and H. Jacqmin-Gadda. Estimating and comparing time-dependent areas under receiver operating characteristic curves for censored event times with competing risks. Statistics in Medicine, 32(30): 5381--5397, 2013.

  7. Paul Blanche, Ce'cile Proust-Lima, Lucie Loube`re, Claudine Berr, Jean- Franc,ois Dartigues, and He'le`ne Jacqmin-Gadda. Quantifying and comparing dynamic predictive accuracy of joint models for longitudinal marker and time-to-event in presence of censoring and competing risks. Biometrics, 71 (1):102--113, 2015.

Functions predict.CauseSpecificCox{.verbatim}, predictCox{.verbatim} and iidCox{.verbatim}:

  • Brice Ozenne, Anne Lyngholm Sorensen, Thomas Scheike, Christian Torp-Pedersen and Thomas Alexander Gerds. riskRegression: Predicting the Risk of an Event using Cox Regression Models. The R Journal (2017) 9:2, pages 440-460.
@article{gerds2006consistent,
  title =    {Consistent Estimation of the Expected {B}rier Score
                  in General Survival Models with Right-Censored Event
                  Times},
  author =   {Gerds, T.A. and Schumacher, M.},
  journal =  {Biometrical Journal},
  volume =   48,
  number =   6,
  pages =    {1029--1040},
  year =     2006,
  publisher =    {Wiley Online Library}
}

@article{gerds2007efron,
  title =    {Efron-Type Measures of Prediction Error for Survival
                  Analysis},
  author =   {Gerds, T.A. and Schumacher, M.},
  journal =  {Biometrics},
  volume =   63,
  number =   4,
  pages =    {1283--1287},
  year =     2007,
  publisher =    {Wiley Online Library}
}

@article{gerds2008performance,
  title =    {The performance of risk prediction models},
  author =   {Gerds, T.A. and Cai, T. and Schumacher, M.},
  journal =  {Biometrical Journal},
  volume =   50,
  number =   4,
  pages =    {457--479},
  year =     2008,
  publisher =    {Wiley Online Library}
}

@Article{mogensen2012pec,
  title =    {Evaluating random forests for survival analysis
                  using prediction error curves},
  author =   {Mogensen, U B and Ishwaran, H. and Gerds, T A},
  journal =  {Journal of Statistical Software},
  year =     2012,
  volume =   50,
  number =   11
}

@article{Blanche2013statmed,
  title =    "{Estimating and comparing time-dependent areas under
                  receiver operating characteristic curves for
                  censored event times with competing risks}",
  author =   {Blanche, P. and Dartigues, J-F and Jacqmin-Gadda,
                  H.},
  journal =  {Statistics in Medicine},
  volume =   32,
  number =   30,
  pages =    {5381--5397},
  year =     2013
}

@article{blanche2015,
  title =    {Quantifying and comparing dynamic predictive
                  accuracy of joint models for longitudinal marker and
                  time-to-event in presence of censoring and competing
                  risks},
  author =   {Blanche, Paul and Proust-Lima, C{\'e}cile and
                  Loub{\`e}re, Lucie and Berr, Claudine and Dartigues,
                  Jean-Fran{\c{c}}ois and Jacqmin-Gadda,
                  H{\'e}l{\`e}ne},
  journal =  {Biometrics},
  volume =   71,
  number =   1,
  pages =    {102--113},
  year =     2015,
  publisher =    {Wiley Online Library}
}

@article{ozenne2017,
  title =    {riskRegression: Predicting the Risk of an Event
                using Cox Regression Modelss},
  author =   {Ozenne, Brice and Sørensen, Anne Lyngholm 
                and Scheike, Thomas and Torp-Pedersen, Christian
                and Gerds, Thomas Alexander},
  journal =  {The R Journal},
  volume =   9,
  number =   2,
  pages =    {440--460},
  year =     2017
}

Copy Link

Version

Install

install.packages('riskRegression')

Monthly Downloads

16,575

Version

2026.02.13

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Thomas Alexander Gerds

Last Published

February 16th, 2026

Functions in riskRegression (2026.02.13)

autoplot.Score

ggplot AUC curve
as.data.table.predictCox

Turn predictCox Object Into a data.table
ate

Average Treatment Effects Computation
as.data.table.influenceTest

Turn influenceTest Object Into a data.table
SurvResponseVar

Extract the time and event variable from a Cox model
anova.ate

Risk Comparison Over Time
as.data.table.predictCSC

Turn predictCSC Object Into a data.table
SuperPredictor

Formula interface for SuperLearner::SuperLearner
SmcFcs

SmcFcs
as.data.table.ate

Turn ate Object Into a data.table
baseHaz_cpp

C++ Fast Baseline Hazard Estimation
coef.ate

Estimated Average Treatment Effect.
autoplot.predictCSC

Plot Predictions From a Cause-specific Cox Proportional Hazard Regression
autoplot.ate

Plot Average Risks
boxplot.Score

Boxplot risk quantiles
coef.CauseSpecificCox

Extract coefficients from a Cause-Specific Cox regression model
calcSeCSC

Standard error of the absolute risk predicted from cause-specific Cox models
boot2pvalue

Compute the p.value from the distribution under H1
calcSeCox

Computation of standard errors for predictions
autoplot.predictCox

Plot Predictions From a Cox Model
colCenter_cpp

Apply - by column
colMultiply_cpp

Apply * by column
confint.influenceTest

Confidence Intervals and Confidence Bands for the Difference Between Two Estimates
coef.wglm

Estimates from IPCW Logistic Regressions
coef.riskRegression

Extract coefficients from riskRegression model
colScale_cpp

Apply / by column
confint.ate

Confidence Intervals and Confidence Bands for the average treatment effect.
confint.predictCSC

Confidence Intervals and Confidence Bands for the Predicted Absolute Risk (Cumulative Incidence Function)
confint.predictCox

Confidence Intervals and Confidence Bands for the predicted Survival/Cumulative Hazard
coxFormula

Extract the formula from a Cox model
colCumSum

Apply cumsum in each column
coxModelFrame

Extract the design matrix used to train a Cox model
coxCenter

Extract the mean value of the covariates
coxSpecial

Special characters in Cox model
coxN

Extract the number of observations from a Cox model
coxStrata

Define the strata for a new dataset
confint.wglm

Confidence intervals for Estimate from IPCW Logistic Regressions
coxLP

Compute the linear predictor of a Cox model
coxBaseEstimator

Extract the type of estimator for the baseline hazard
coxStrataLevel

Returns the name of the strata in Cox model
ipcw

Estimation of censoring probabilities
iidCox

Extract iid decomposition from a Cox model
is.iidCox

Check Computation of the Influence Function in a Cox Model
iid.wglm

IID for IPCW Logistic Regressions
coxVarCov

Extract the variance covariance matrix of the beta from a Cox model
coxVariableName

Extract variable names from a model
getSplitMethod

Input for data splitting algorithms
discreteRoot

Dichotomic search for monotone function
influenceTest

Influence test [Experimental!!]
plotEffects

Plotting time-varying effects from a risk regression model.
model.matrix.cph

Extract design matrix for cph objects
information.wglm

Information for IPCW Logistic Regressions
plotBrier

Plot Brier curve
plotAUC

Plot of time-dependent AUC curves
model.matrix.phreg

Extract design matrix for phreg objects
penalizedS3

S3-wrapper for S4 function penalized
plot.riskRegression

Plotting predicted risk
plotCalibration

Plot Calibration curve
model.tables.ate

Statistical Inference for the Average Treatment Effect
predict.riskRegression

Predict individual risk.
predictCox

Survival probabilities, hazards and cumulative hazards from Cox regression models
plotRisk

plot predicted risks
plotROC

Plot ROC curves
predict.FGR

Predict subject specific risks (cumulative incidence) based on Fine-Gray regression model
model.tables.wglm

Statistical Inference for Estimate from IPCW Logistic Regressions
print.CauseSpecificCox

Print of a Cause-Specific Cox regression model
predict.CauseSpecificCox

Predicting Absolute Risk from Cause-Specific Cox Models
plotPredictRisk

Plotting predicted risks curves.
predictRisk

Extrating predicting risks from regression models
predictCoxPL

Deprecated Function for Product Limit Estimation of Survival Probabilities .
print.FGR

Print of a Fine-Gray regression model
print.IPA

Print IPA object
print.predictCSC

Print Predictions From a Cause-specific Cox Proportional Hazard Regression
print.ate

Print Average Treatment Effects
print.GLMnet

Print of a glmnet regression model
print.influenceTest

Output of the DIfference Between Two Estimates
print.subjectWeights

Print subject weights
print.predictCox

Print Predictions From a Cox Model
print.riskRegression

Print function for riskRegression models
print.Score

Print Score object
reconstructData

Reconstruct the original dataset
print.synth_code

Print synthesized code
riskRegression.options

Global options for riskRegression
riskRegression

Risk Regression Fits a regression model for the risk of an event -- allowing for competing risks.
rowScale_cpp

Apply / by row
rowSumsCrossprod

Apply crossprod and rowSums
riskLevelPlot

Level plots for risk prediction models
sampleData

Simulate data with binary or time-to-event outcome
riskRegression-package

Risk Regression Models and Prediction Scores for Survival Analysis with Competing Risks
rowPaste

Collapse Rows of Characters.
rowMultiply_cpp

Apply * by row
selectCox

Backward variable selection in the Cox regression model
rowCenter_cpp

Apply - by row
simMelanoma

Simulate data alike the Melanoma data
simPBC

simulating data alike the pbc data
simActiveSurveillance

Simulate data of a hypothetical active surveillance prostate cancer study
rowCumSum

Apply cumsum in each row
saveSynth

Export a synth object.
score.wglm

Score for IPCW Logistic Regressions
selectJump

Evaluate the influence function at selected times
summary.Score

Summary of prediction performance metrics
summary.ate

Summary Average Treatment Effects
subsetIndex

Extract Specific Elements From An Object
transformCIBP

Compute Confidence Intervals/Bands and P-values After a Transformation
terms.phreg

Extract terms for phreg objects
summary.FGR

Summary of a Fine-Gray regression model
saveCoxConfidential

Save confidential Cox objects
simsynth

Simulating from a synthesized object
wglm

Logistic Regression Using IPCW
splitStrataVar

Reconstruct each of the strata variables
subjectWeights

Estimation of censoring probabilities at subject specific times
weights.wglm

Extract IPCW Weights
summary.riskRegression

Summary of a risk regression model
vcov.ate

Variance-Covariance Matrix for the Average Treatment Effect.
synthesize

Cooking and synthesizing survival data
vcov.wglm

Variance-covariance for IPCW Logistic Regressions
Melanoma

Malignant melanoma data
Hal9001

Fitting HAL for use with predictRisk
GLMnet

Formula interface for glmnet
Score

Score risk predictions
IPA

Explained variation for settings with binary, survival and competing risk outcome
Ctree

S3-Wrapper for ctree.
Paquid

Paquid sample
Cforest

S3-wrapper function for cforest from the party package
CSC

Cause-specific Cox proportional hazard regression
FGR

Formula wrapper for crr from cmprsk