Description Usage Arguments Details Value Functions
At each iteration, a single decision tree is fit using gbm.fit, and
the terminal node means are allowed to vary by group using lmer.
1 2 3 4 5 6 7 8 9 | metb(y, X, id, n.trees = 5, interaction.depth = 3, n.minobsinnode = 20,
shrinkage = 0.01, bag.fraction = 0.5, train.fraction = NULL,
cv.folds = 1, subset = NULL, indep = TRUE, save.mods = FALSE,
mc.cores = 1, num_threads = 1, verbose = TRUE, ...)
metb.fit(y, X, id, n.trees = 5, interaction.depth = 3,
n.minobsinnode = 20, shrinkage = 0.01, bag.fraction = 0.5,
train.fraction = NULL, subset = NULL, indep = TRUE, num_threads = 1,
save.mods = FALSE, verbose = TRUE, ...)
|
y |
outcome vector (continuous) |
X |
matrix or data frame of predictors |
id |
name or index of grouping variable |
n.trees |
the total number of trees to fit (iterations). |
interaction.depth |
The maximum depth of trees. 1 implies a single split (stump), 2 implies a tree with 2 splits, etc. |
n.minobsinnode |
minimum number of observations in the terminal nodes of each tree |
shrinkage |
a shrinkage parameter applied to each tree. Also known as the learning rate or step-size reduction. |
bag.fraction |
the fraction of the training set observations randomly
selected to propose the next tree. This introduces randomnesses into the model
fit. If |
train.fraction |
of sample used for training |
cv.folds |
number of cross-validation folds. In addition to the usual fit, will perform cross-validation over a grid of meta-parameters (see details). |
subset |
index of observations to use for training |
indep |
whether random effects are independent or allowed to covary (default is TRUE, for speed) |
save.mods |
whether the |
mc.cores |
number of parallel cores |
num_threads |
number of threads |
verbose |
In the final model fit, will print every '10' trees/iterations. |
... |
arguments passed to gbm.fit |
Meta-parameter tuning is handled by passing vectors of possible values for
n.trees, shrinkage, indep, interaction.depth,
and n.minobsinnode and setting cv.folds > 1. Setting
mc.cores > 1 will carry out the tuning in parallel by forking via
mclapply. Tuning is only done within the training set.
Prediction is most easily carried out by passing the entire X matrix to
metb, and specifying the training set using subset. Otherwise,
set save.mods=TRUE and use predict.
An metb object consisting of the following list elements:
yhatVector of predictions at the best iteration (fixed + ranef)
ranefVector of random effects at the best iteration
fixedVector of fixed effect predictions at the best iteration
shrinkangeAmount of shrinkage
subsetVector of observations used for training
best.treesBest number of trees by training, test, oob, and cv error
best.paramsThe best set of meta-parameter values given by CV
paramsA data frame of all meta-parameter combinations and the corresponding CV error
sigmaThe variance due to the grouping variable at each iteration
xnamesColumn names of X
modsList of lmer models (if save.mods=TRUE)
idname or index of the grouping variable
treesList of trees fit at each iteration
initinitial prediction
var.typeType of variables (gbm.fit)
c.splitList of categorical splits (gbm.fit)
train.errTraining error at each iteration
oob.errOut of bag error at each iteration
test.errTest error at each iteration
cv.errCross-validation error at each iteration
metb.fit: Fitting function for metb
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.