Usage
## S3 method for class 'formula':
randomForest(formula, data=NULL, subset, ...)
## S3 method for class 'default':
randomForest(x, y=NULL, xtest, ytest, addclass=0, ntree=500,
mtry=ifelse(is.null(y) || is.factor(y), max(floor(ncol(x)/3), 1),
floor(sqrt(ncol(x)))), classwt=NULL,
nodesize=ifelse(is.null(y) || is.factor(y), 5, 1),
importance=FALSE,
proximity=FALSE, outscale=FALSE, norm.votes=TRUE, do.trace=FALSE,
keep.forest=is.null(xtest), ...)
## S3 method for class 'randomForest':
print(x, ...)
Arguments
formula
a symbolic description of the model to be fitted.
data
an optional data frame containing the variables in the model.
By default the variables are taken from the environment which
randomForest
is called from.
subset
an index vector indicating which rows should be used.
x
a data frame or a matrix of predictors (for the
print
method, an randomForest
object).
y
A response vector. If a factor, classification is assumed,
otherwise regression is assumed. If omitted, randomForest
will run in unsupervised mode with addclass=1
(unless
explicitly set otherwise).
xtest
a data frame or matrix (like x
) containing
predictors for the test set.
ytest
response for the test set.
addclass
=0
(default) do not add a synthetic class to
the data. =1
label the input data as class 1 and add a
synthetic class by randomly sampling from the product of empirical
marginal distributions of the input. =2
ntree
Number of trees to grow. This should not be set to too
small a number, to ensure that every input row gets predicted at
least a few times.
mtry
Number of variables randomly sampled as candidates at each
split. Note that the default values are different for
classification and regression
classwt
Priors of the classes. Need not add up to one.
Ignored for regression.
nodesize
Minimum size of terminal nodes. Setting this number
larger causes smaller trees to be grown (and thus take less time).
Note that the default values are different for classification
and regression.
importance
Should importance of predictors be assessed?
proximity
Should proximity measure among the rows be
calculated? Ignored for regression.
outscale
Should outlyingness of rows be assessed? Ignored for
regression.
norm.votes
If TRUE
(default), the final result of votes
are expressed as fractions. If FALSE
, raw vote counts are
returned (useful for combining results from different runs).
Ignored for regression.
do.trace
If set to TRUE
, give a more verbose output as
randomForest
is run. If set to some integer, then running
output is printed for every do.trace
trees.
keep.forest
If set to FALSE
, the forest will not be
retained in the output object. If xtest
is given, defaults
to FALSE
.
...
optional parameters to be passed to the low level function
randomForest.default
.