The function
survival_forest_matrix build a survival forest given the survival outcomes and predictors of numeric and factor variables.
survival_forest_matrix(
time,
event,
matrix_numeric,
matrix_factor,
weights = rep(1, length(time)),
significance = 0.05,
min_weights = 50,
missing = "omit",
test_type = "univariate",
cut_type = 0,
nboot = 100,
seed = 0,
args_miceRanger = NULL
)A list containing the information of the survival forest fit.
survival times, a numeric vector.
time[i] is the survival time of the ith sample.
survival events, a logical vector.
event[i] is the survival event of the ith sample.
numeric predictors, a numeric matrix.
matrix_numeric[i,j] is the jth numeric predictor of the ith sample.
factor predictors, a character matrix.
matrix_factor[i,j] is the jth predictor of the ith sample.
sample weights, a numeric vector.
weights[i] is the weight of the ith sample.
significance threshold, a numeric value.
Stop the splitting algorithm when no splits give a p-value smaller than significance.
minimum weight threshold, a numeric value.
The weights in a node are greater than min_weights.
a character value that specifies the handling of missing data.
If missing=="omit", samples with missing values in the splitting variables will be discarded.
If missing=="majority", samples with missing values in the splitting variables will be assigned to the majority node.
If missing=="weighted", samples with missing values in the splitting variables will be weighted by the weights of branch nodes.
a character value that specifies the type of statistical tests.
If test_type=="univariate", then it performs a log-rank test without p-value adjustments.
If test_type is in p.adjust.methods, i.e., one of holm, hochberg, hommel, bonferroni, BH, BY, or fdr,
then the p-values will be adjusted using the corresponding method.
an integer value that specifies how to cut between two numeric values.
If cut_type==0, then cut at the ends.
If cut_type==1, then cut from the middle.
If cut_type==2, then cut randomly between the two values.
an integer value that specifies the number of bootstrap replications.
an integer value that specifies the seed.
a list specifying additional arguments to be used to impute missing data using miceRanger().
Only applies when missing=="miceRanger".
Build a Survival Forest (Data Supplied as Matrices)
# \donttest{
library(survival)
a_survival_forest<-
survival_forest_matrix(
time=lung$time,
event=lung$status==2,
matrix_numeric=data.matrix(lung[,c(4,6:9),drop=FALSE]),
matrix_factor=data.matrix(lung[,5,drop=FALSE]),
nboot=20)
# }
Run the code above in your browser using DataLab