I would like to bootstrap with weights in random survival forest (randomForestSRC package) because I have a case-cohort study design.
Please let me know how to add the "weights" option in this analysis.
Thank you.
Here is my code below. (implemented with sample data)
install.packages("randomForestSRC")
library(randomForestSRC)
data(pbc, package="randomForestSRC")
data <- na.omit(pbc)
rsf <- rfsrc(Surv(days, status)~.,
data=data,
ntree=500,
tree.err=T,
importance=T,
proximity=T)
You should look at the bootstrap related options in the man page for rfsrc() on CRAN. In the CRAN package, the option "samp" allows you to explicitly specify the bootstrap for every tree. Hence, you would populate an n x ntree matrix of indices based on your weights. A slightly more pictorial depiction of how ntree, the bootstrap option, sample type, sample size, and sample all interact is given on our GitHub page:
https://kogalur.github.io/randomForestSRC/javadoc/index.html