Author: Katrin Madjar
Contact: Katrin.Madjar@stat.uni-muenchen.de

The given R files are associated with the following publication:

Madjar K and Rahnenführer J (2019). Weighted Cox regression for the prediction of heterogeneous patient subgroups.



OVERVIEW OF FILES ----------------------------------------------------------


Run_Simulation.R
------------------------------
Setup and running of the simulation described in Section 4 of the publication, including computation and evaluation of our proposed weighted Cox model, 
as well as the two standard unweighted Cox models and the weighted Cox model with fixed weights.
All simulations are run using the R package batchtools for parallelization.

Run_RealDataApplication.R
------------------------------
Setup and running of the real data application described in Section 5 of the publication, including computation and evaluation of our proposed weighted Cox model, 
as well as the two standard unweighted Cox models and the weighted Cox model with fixed weights.
All models can be run with different gene filters and covariate sets (here only genetic covariates are included).
All settings are run using the R package batchtools for parallelization.

DataSimulation.R
------------------------------
Helper functions for generation of simulated (training and test) data. Only needed in simulation study, not real data application.

StratifiedSubsampling.R
------------------------------
Function for stratified random subsampling and generation of training and test data ("problem" function in batchtools, see file 
"Run_RealDataApplication.R"). Only needed in real data application, not in simulation study.

SurvivalWrapper.R
------------------------------
Wrapper function for running of a specific type of Cox model with, in the case of the real data application, a specific covariate set and gene filter.
The cox model is fitted based on the training data and evaluated based on the test data.
This function includes the following three functions.

DataPreparation.R
------------------------------
Function for preparation of the training and test data for model fitting and evaluation: standardization of numerical covariates, application of the 
gene filter to the genetic covariates (if defined), and definition of a penalty value for each covariate (only interesting in the case of a combination
of clinical and genetic covariates, where only genes are penalized and clinical variables are included as mandatory (unpenalized) into the model).

EstimateWeights.R
------------------------------
Function to determine individual weights for each patient in the training set and in each subgroup model (either estimated weights as proposed by us 
with different classification methods or fixed weights as proposed by Weyer and Binder, 2015).

CoxModelBuilder.R
------------------------------
Function to fit (weighted) l1-penalized Cox model.


Weibull_param.RData
------------------------------
RData object with parameters of the Weibull distribution used for data simulation (see file "DataSimulation.R")

Realdata_LC.RData
------------------------------
RData object with preprocessed data of lung cancer cohorts, including information on survival endpoint, clinical covariates, genetic covariates, cohort 
membership of each patient, and gene filters (see file "Run_RealDataApplication.R")


Start with file Run_Simulation or Run_RealDataApplication.R.