| impute.rfsrc {randomForestSRC} | R Documentation |
Fast imputation mode. A random forest is grown and used to impute missing data. No ensemble estimates or error rates are calculated.
## S3 method for class 'rfsrc' impute(formula, data, ntree = 1000, mtry = NULL, nodesize = NULL, splitrule = NULL, nsplit = 1, nimpute = 1, xvar.wt = NULL, seed = NULL, do.trace = FALSE, ...)
formula |
A symbolic description of the model to be fit. Can be left unspecified if there are no outcomes or we don't care to distinguish between y-outcomes and x-variables in the imputation. |
data |
Data frame containing the data to be imputed. |
ntree |
Number of trees to grow. |
mtry |
Number of variables randomly sampled at each split. |
nodesize |
Minimum terminal node size. |
splitrule |
Splitting rule used to grow trees. |
nsplit |
Non-negative integer value used to specify random splitting. |
nimpute |
Number of iterations of missing data algorithm. |
xvar.wt |
Weights for selecting variables for splitting on. |
seed |
Seed for random number generator. |
do.trace |
Should trace output be enabled? |
... |
Further arguments passed to or from other methods. |
Grow a forest and use this to impute data. All external calculations such as ensemble calculations, error rates, etc. are turned off. Use this function if your only interest is imputing the data.
If no formula is specified, unsupervised splitting is implemented which treats the data as if there are no y-outcomes.
All options are the same as rfsrc and the user should
consult the help file for rfsrc for details.
Invisibly, the data frame containing the orginal data with imputed data overlayed. The first column(s) contain the y outcome values.
Hemant Ishwaran and Udaya B. Kogalur
Ishwaran H., Kogalur U.B., Blackstone E.H. and Lauer M.S. (2008). Random survival forests, Ann. App. Statist., 2:841-860.
## ------------------------------------------------------------
## example of survival imputation
## ------------------------------------------------------------
#imputation using outcome splitting
data(pbc, package = "randomForestSRC")
pbc.d <- impute.rfsrc(Surv(days, status) ~ ., data = pbc, nsplit = 3)
#when no formula is given we default to unsupervised splitting
pbc2.d <- impute.rfsrc(data = pbc, nodesize = 1, nsplit = 10, nimpute = 5)
#random splitting can be reasonably good
pbc3.d <- impute.rfsrc(Surv(days, status) ~ ., data = pbc,
splitrule = "random", nodesize = 1, nimpute = 5)
## ------------------------------------------------------------
## example of regression imputation
## ------------------------------------------------------------
air.d <- impute.rfsrc(Ozone ~ ., data = airquality, nimpute = 5)
air2.d <- impute.rfsrc(data = airquality, nimpute = 5, nodesize = 1)
air3.d <- impute.rfsrc(Ozone ~ ., data = airquality, nimpute = 5,
splitrule = "random", nodesize = 1)