| rf.LOO | R Documentation |
Function to run a Leave-One-Out random forest model. Two methods can be specified: LOSO and LOBO.
LOSO (Leave-One-Subject-Out) will remove one entire subject from the training set, and then test the model on the removed subject, repeating on all subjects in the dataframe. This offers population level classification.
LOBO (Leave-One-Beep-Out) offers within subject level predictions for EMA(Ecological Momentary Assessment) type data by training models on single subjects minus one Beep. Classification are thus derived for each subject this way. This analysis can be implemented on other types of trial based data.
rf.LOO(data, sub_id, xvars, yvar, ntree, method, progress)
data |
Dataframe to be used by model |
sub_id |
String indicating what variable to use as subject ID |
xvars |
Vector of strings to be used for model training |
yvar |
A response string. Must be a character/factor. Otherwise, use rf.LOOreg for regression version (in development). |
ntree |
Integer indicating number of trees to simulate. Defaults to 1000. |
method |
String, can be "LOSO" or "LOBO". Defaults to "LOBO". |
progress |
Logical indicating if progress to be printed. Default True. |
Results of the LOO analysis as a list:
model |
Information on the model that was run |
subject |
Results for each subject, including the predictions made as a list, a confusion matrix, and the mean error |
errors |
Mean error rate returned per subject |
mean_errors |
Population level error rate across subjects |
Currenlty implemented only for factors, and tested for two and three levels.
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.