forked from ruthkeogh/superlearner_survival_tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME
More file actions
106 lines (79 loc) · 5.4 KB
/
README
File metadata and controls
106 lines (79 loc) · 5.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#################################################################################
#################################################################################
#Super learner for time-to-event outcomes tutorial
#Ruth Keogh, July 2025
#################################################################################
#################################################################################
################
##set-up files##
################
Run these (packages.R first, rotterdam_setup.R second) before using the other files that run the analyses.
packages.R
- Loads packages required across all analyses.
- To install survSuperLearner, use:
library(devtools)
devtools::install_github("tedwestling/survSuperLearner")
More information is available at https://github.com/tedwestling/survSuperLearner
- To install statelearner, download the repository at https://github.com/amnudn/joint-survival-super-learner/tree/main
and load all functions in the R-code folder
rotterdam_setup.R
- Sets up the Rotterdam dta (available in the survival package). This includes imposing administrative censoring at 10 years. Training and test data sets are created baed on a 70%/30% split. The training data dta_train is used for model fitting and dta_test is used as a holdout or test data set.
functions.R
- Includes functions used to calculate measures of predictive performance.
censoring_weights_KM.R
censoring_weights_discretetime_SL.R
censoring_weights_continuoustime_SL_Westling.R
censoring_weights_continuoustime_SL_MunchGerds.R
- Obtain censoring weights in the test data (dta_test), which are required for estimating predictive performance measures using the functions in functions.R, and in some functions used from packages.
- censoring_weights_KM.R obtain the weights using Kaplan-Meier, assuming censoring is independent of covariates.
- The other three censoring weights files obtain the weights using super learners of different types, allowing censoring to depend on covariates
#################################################
##files implementing individual models/learners##
#################################################
method_coxph.R
- Fits a Cox model to dta_train and evaluates predictive performance in dta_test.
method_coxlasso.R
- Fits a Cox model with Lasso to dta_train and evaluates predictive performance in dta_test.
method_rfsrc.R
- Fits a survival random forest to dta_train and evaluates predictive performance in dta_test.
###################################################
##files implementing discrete-time super learners##
###################################################
method_discretetime_SL_10periods.R
- Implements the discrete-time ensemble SL of Polley & van der Laan 2011 using dta_train and evaluates predictive performance in dta_test.
- Uses discretisation into 10 time periods of equal length.
- Uses the SuperLearner package.
method_discretetime_SL_10periods_extralearners.R
- As in method_discretetime_SL_10periods.R, but using a larger set of candidate learners.
method_discretetime_SL_100periods.R
- Implements the discrete-time ensemble SL of Polley & van der Laan 2011 using dta_train and evaluates predictive performance in dta_test.
- Uses discretisation into 100 time periods of equal length.
- Uses the SuperLearner package.
method_discretetime_SL_100periods_extralearners.R
- As in method_discretetime_SL_100periods.R, but using a larger set of candidate learners.
method_discretetime_SL_100periods_byhand.R
- Implements the discrete-time ensemble SL of Polley & van der Laan 2011 using dta_train and evaluates predictive performance in dta_test.
- Uses discretisation into 100 time periods of equal length.
- Show how to do this 'by hand' without using the SuperLearner package.
#####################################################
##files implementing continuous-time super learners##
#####################################################
method_continuoustime_SL_Westling.R
- Implements the continuous-time ensemble SL of Westling et al. 2023 using dta_train and evaluates predictive performance in dta_test.
- Uses the survSuperLearner package.
method_continuoustime_SL_Westling_extralearners.R
- As in method_continuoustime_SL_Westling.R, but using a larger set of candidate learners.
method_continuoustime_SL_MunchGerds.R
- Implements the continuous-time discrete SL of Munch & Gerds 2024 using dta_train and evaluates predictive performance in dta_test.
- Uses code from https://github.com/amnudn/joint-survival-super-learner.
method_continuoustime_SL_MunchGerds_byhand.R
- Implements the continuous-time discrete SL of Munch & Gerds 2024 using dta_train and evaluates predictive performance in dta_test.
- Show how to do this 'by hand' without using the statelearner code.
#########################################################
##files implementing pseudo observations super learner##
#########################################################
method_pseudoobs_SL.R
- Implements the SL for pseudo observations as described by Sachs et al. 2019, using dta_train and evaluates predictive performance in dta_test.
- Uses the superLearner package, and makes use of Michael Sach's code from https://github.com/sachsmc/pseupersims
functions_pseudoobs_SL.R
- This file provides functions from the utils.R file of Sachs (https://github.com/sachsmc/pseupersims), with minor modifications to remove the handling of competing events.