Skip to content

Commit d3ae27c

Browse files
authored
Update README.md
1 parent 8296151 commit d3ae27c

File tree

1 file changed

+6
-35
lines changed

1 file changed

+6
-35
lines changed

README.md

+6-35
Original file line numberDiff line numberDiff line change
@@ -21,38 +21,9 @@ require(SuperLearner)
2121
2. Define the learners that you want to use in superlearner training
2222

2323
```{r}
24-
#Logistic Regression
25-
SL.glm.DCDR <- function(...){
26-
SL.glm(...)
27-
}
28-
29-
#4 degree GAM
30-
SL.gam4.DCDR <- function(...){
31-
SL.gam(..., deg.gam=4)
32-
}
33-
34-
#6 degree GAM
35-
SL.gam6.DCDR <- function(...){
36-
SL.gam(..., deg.gam=6)
37-
}
38-
39-
#Neural Network
40-
SL.nnet.DCDR <- function(...){
41-
SL.nnet(..., size=4)
42-
}
43-
44-
#Random forest
45-
SL.randomForest.DCDR <- function(...){
46-
SL.randomForest(..., ntree=500, nodesize=20)
47-
}
48-
49-
#Empirical mean
50-
SL.mean.DCDR <- function(...){
51-
SL.mean(...)
52-
}
53-
24+
# learners can be defined from `Superlearner::SL.library()`
25+
learners = c("SL.glm","SL.glmnet", "SL.xgboost")
5426
55-
learners <- c("SL.glm.DCDR", "SL.gam4.DCDR", "SL.gam6.DCDR", "SL.nnet.DCDR", "SL.randomForest.DCDR", "SL.mean.DCDR")
5627
```
5728

5829
3. Defining the data you want to use
@@ -67,11 +38,11 @@ df = data
6738
exposure="statin"
6839
outcome="Y"
6940
70-
covarsT <- c("age", "ldl_log", "risk_score") # covariate for exposure
71-
covarsO <- c("age", "ldl_log", "risk_score") # covariate for outcome
41+
covarsT <- c("age", "ldl_log", "risk_score") # covariate for exposure model
42+
covarsO <- c("age", "ldl_log", "risk_score") # covariate for outcome model
7243
73-
# Here `V=5' indicates the number of cross-validation folds that is applied in the superlearner training.
74-
control <- SuperLearner.CV.control(V=5)
44+
# Controls parameters to be used in cross-validation in the superlearner training. Similar as `Superlearner::cvControl()`
45+
control <- SuperLearner.CV.control(V=5)
7546
7647
## Wrapper functions
7748

0 commit comments

Comments
 (0)