rf_tune {glmnetr}R Documentation

Fit a Random Forest model on data provided in matrix and vector formats.

Description

Fit an Random Forest model using the rfsrc() function of the randomForestSRC package.

Usage

rf_tune(
  xs,
  start = NULL,
  y_,
  event = NULL,
  family = NULL,
  mtryc = NULL,
  ntreec = NULL,
  nsplitc = 8,
  seed = NULL,
  track = 0
)

Arguments

xs

predictor input - an n by p matrix, where n (rows) is sample size, and p (columns) the number of predictors. Must be in matrix form for complete data, no NA's, no Inf's, etc., and not a data frame.

start

an optional vector of start times in case of a Cox model. Class numeric of length same as number of patients (n)

y_

dependent variable as a vector: time, or stop time for Cox model, Y_ 0 or 1 for binomial (logistic), numeric for gaussian. Must be a vector of length same as number of sample size.

event

event indicator, 1 for event, 0 for census, Cox model only. Must be a numeric vector of length same as sample size.

family

model family, "cox", "binomial" or "gaussian" (default)

mtryc

a vector (numeric) of values to search over for optimization of the Random Forest fit. This if for the mtry input variable of the rfsrc() program specifying the number of terms to consider in each step of teh Random Forest fit.

ntreec

a vector (numeric) of 2 values, the first for the number of forests (ntree from rfsrc()) to use when searhcing for a better bit and the second to use when fitting the final model. More trees should give a better fit but require more computations and storage for the final. model.

nsplitc

This nsplit of rfsrc(), a non-negative integer for the number of random splits for a predictor.

seed

a seed for set.seed() so one can reproduce the model fit. If NULL the program will generate a random seed. Whether specified or NULL, the seed is stored in the output object for future reference. Note, for the default this randomly generated seed depends on the seed in memory at that time so will depend on any calls of set.seed prior to the call of this function.

track

1 to output a brief summary of the final selected model, 2 to output a brief summary on each model fit in search of a better model or 0 (default) to not output this information.

Value

a Random Forest model fit

Author(s)

Walter Kremers (kremers.walter@mayo.edu)

See Also

summary.rf_tune , rederive_rf , nested.glmnetr


[Package glmnetr version 0.5-1 Index]