rf.boot: Bootstrap analysis for null hypothesis testing of random...

View source: R/rf.boot.R

rf.bootR Documentation

Bootstrap analysis for null hypothesis testing of random forests with Leave-One-Out procedures.

Description

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.

Usage

rf.boot(data, sub_id, xvar, yvar, method, ntree, iterations, ncore)

Arguments

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.

Value

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

Note

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.

Author(s)

Rayyan Tutunji | rayyan.tutunji[at]donders.ru.nl

References

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


raytut/randomForestLOO documentation built on May 30, 2022, 8:47 p.m.