| rf.boot | R Documentation |
Function to run a bootstrap analysis with leave-one-out analysis. Returns a dataframe with all bootstrap errors for the estimations, and the average errors per subject.
rf.boot(data, sub_id, xvar, yvar, method, ntree, iterations, ncore)
data |
Dataframe to be used by model |
sub_id |
String indicating what variable to use as subject ID |
xvar |
Vector of strings to be used for model training |
yvar |
A response string. Must be of type factor. |
method |
String, can be "LOSO" or "LOBO". Default="LOBO". |
ntree |
Integer indicating number of trees to simulate. Default=1000. |
iterations |
Number of times to run bootstrap. Default=5000. |
ncore |
Number of cores assigned for parallel processing. Default=1 (Not recommended). Will always use n-1 to ensure at least one core remains available and free for smooth operaitons. |
Results of the bootstrap analysis as a list:
model |
Information on the model that was run |
subject |
Results for each subject, including the predictions made, a confusion matrix, and the mean error |
errors |
Mean error rate returned per subject |
mean_errors |
Mean error rate across subjects |
Currenlty implemented only for factors. Random forests are not optimal for regressions, limiting the utility of such applicaitons. Note that sometimes the total number of iterations may be slightly different. This is because failed bootstraps are discarded from the final dataframe.
Rayyan Tutunji | rayyan.tutunji[at]donders.ru.nl
Using wearable biosensors and ecological momentary assessments for the detection of prolonged stress in real life Rayyan Tutunji, Nikos Kogias, Bob Kapteijns, Martin Krentz, Florian Krause, Eliana Vassena, Erno Hermans bioRxiv 2021.06.29.450360; doi: https://doi.org/10.1101/2021.06.29.450360
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.