← StatFas.com · All tutorials

StatFAS tutorial · Updated

How to Analyse a Random Forest Model Online

This tutorial walks through a complete classification analysis in the StatFAS Random Forest calculator, from loading data to copying APA 7 results. You need no coding. Everything runs in your browser and your data are not uploaded to a server.

Open the calculator

New to Random Forests? Start with Random Forests Explained.

1Prepare your data

Want to practise first? Click Load example data: 300 synthetic telecom clients, nine predictors and the contact channel as the outcome.

2Load the data

Paste into the text box, or choose a CSV/TSV/TXT file, then click Read data. The tool reports how many rows and columns it found. With the example data, the last column (channel) is selected as the outcome automatically.

3Choose outcome and predictors

Pick the outcome in Outcome (class) column. All numeric columns are ticked as predictors by default; untick identifiers (such as case numbers) or anything that would not be available when predicting. Including irrelevant columns is allowed, since forests are good at ignoring them, but IDs can mislead.

4Set the forest

SettingWhat it doesSuggested start
TreesNumber of trees voted together. More trees give steadier results.100–500
Max depthMaximum levels per tree. Shallower trees are easier to read; deeper trees fit more detail.3–6 for viewing, more for accuracy
Min leaf sizeSmallest number of cases allowed in a leaf. Larger values smooth the model.1–5
mtryFeatures tried at each split. 0 means the square root of the number of predictors.0 (automatic)
SeedMakes the random draws repeatable, so you and others can reproduce the run.Any number; keep it and report it

Click Run Random Forest. The results appear below within seconds for typical data.

5Read the summary

The summary lists the sample size, trees, mtry, depth, out-of-bag (OOB) accuracy and Cohen’s κ. OOB accuracy comes from cases each tree did not see during training, so it is an honest estimate without a separate test set. κ corrects accuracy for agreement expected by chance; values nearer 1 mean stronger agreement.

Example result (example data, default settings, seed 42): N = 300, 100 trees, mtry = 3, depth ≤ 5, OOB accuracy = .92, κ = .88.

6Interpret the five figures

Figure 1: Feature importance. Bars show Gini importance (larger means the feature cut impurity more across the forest); black markers show each feature’s share of all splits. In the example, avg_kb_week (.43), avg_sms_week (.22) and tariff (.21) dominate, while gender, client_app and standing_order are about .01. That is the pattern of a sparse problem: a few strong features and several noise features (Biau, 2012).

Figure 2: Tree scatterplot. Each dot is a tree: impurity on the x-axis, its highest feature importance on the y-axis, colour by that feature. Click any dot to load it into Figure 5. Look for clusters and outlying trees.

Figure 3: Classification grid. Rows are features, columns are tree depths, and each stacked bar shows which class the splits on that feature favour at that depth. Features whose bars are dominated by one colour are linked to that class.

Figure 4: Pyramid matrix. Each pie summarises leaves whose rule path uses both features (the diagonal shows single features). A near-single-colour pie means that pair points strongly to one class; evenly mixed pies indicate weaker influence. Hover to read percentages.

Figure 5: Single tree. Bars at each node show class counts, the label gives the split rule (feature ≤ threshold), link thickness shows how many cases flowed through, and circles at the leaves are coloured by majority class. Follow a path from the root to see a classification rule.

These figures follow the design ideas of Maçãs et al. (2024). Importance describes how the model works; it does not prove that a feature causes the outcome.

7Copy your APA 7 results

Scroll to APA 7 report. It contains Method and Results paragraphs, tables of importance, per-class precision, recall and F1, and the OOB confusion matrix, figure captions, a short sparsity note, limitations, and the reference list. Click Copy report to paste into Word with formatting, or Download report (.html). Then replace generic wording with your own research question and variable names.

8Customise the figures

9Troubleshooting

MessageFix
Select at least two numeric predictorsTick more columns, or convert text predictors to numbers.
The outcome must have 2 to 8 categoriesChoose a categorical column or merge rare categories. A continuous outcome is not supported.
At least 20 complete cases are neededCheck missing values or the delimiter in your pasted data.

Reporting checklist

How to cite

Biau, G. (2012). Analysis of a random forests model. Journal of Machine Learning Research, 13(38), 1063–1095. https://jmlr.org/papers/v13/biau12a.html

Breiman, L. (2001). Random forests. Machine Learning, 45(1), 5–32. https://doi.org/10.1023/A:1010933404324

Maçãs, C., Campos, J. R., Lourenço, N., & Machado, P. (2024). Visualisation of random forest classification. Information Visualization, 23(4), 312–327. https://doi.org/10.1177/14738716241260745

StatFAS. (). Random forest calculator and visualiser [Online tool]. https://statfas.com/random-forest-calculator

In text: (StatFAS, ). The date updates automatically each day.