• Descriptive
    • Moments
    • Concentration
    • Central Tendency
    • Variability
    • Stem-and-Leaf Plot
    • Histogram & Frequency Table
    • Data Quality Forensics
    • Conditional EDA
    • Quantiles
    • Kernel Density Estimation
    • Normal QQ Plot
    • Bootstrap Plot

    • Multivariate Descriptive Statistics
  • Distributions
    • Binomial Probabilities
    • Geometric Probabilities
    • Negative Binomial Probabilities
    • Hypergeometric Probabilities
    • Multinomial Probabilities
    • Dirichlet
    • Poisson Probabilities

    • Exponential
    • Gamma
    • Erlang
    • Weibull
    • Rayleigh
    • Maxwell-Boltzmann
    • Lognormal
    • Pareto
    • Inverse Gamma
    • Inverse Chi-Square

    • Beta
    • Power
    • Beta Prime (Inv. Beta)
    • Triangular

    • Normal (area)
    • Logistic
    • Laplace
    • Cauchy (standard)
    • Cauchy (location-scale)
    • Gumbel
    • Fréchet
    • Generalized Extreme Value

    • Normal RNG
    • ML Fitting
    • Tukey Lambda PPCC
    • Box-Cox Normality Plot
    • Noncentral t
    • Noncentral F
    • Sample Correlation r

    • Empirical Tests
  • Hypotheses
    • Theoretical Aspects of Hypothesis Testing
    • Bayesian Inference
    • Minimum Sample Size

    • Empirical Tests
    • Multivariate (pair-wise) Testing
  • Models
    • Manual Model Building
    • Guided Model Building
  • Time Series
    • Time Series Plot
    • Decomposition
    • Exponential Smoothing

    • Blocked Bootstrap Plot
    • Mean Plot
    • (P)ACF
    • VRM
    • Standard Deviation-Mean Plot
    • Spectral Analysis
    • ARIMA

    • Cross Correlation Function
    • Granger Causality
  1. Regression Models
  2. 141  Leaf Diagnostics for Conditional Inference Trees
  • Preface
  • Getting Started
    • 1  Introduction
    • 2  Why Do We Need Innovative Technology?
    • 3  Basic Definitions
    • 4  The Big Picture: Why We Analyze Data
  • Introduction to Probability
    • 5  Definitions of Probability
    • 6  Jeffreys’ axiom system
    • 7  Bayes’ Theorem
    • 8  Sensitivity and Specificity
    • 9  Naive Bayes Classifier
    • 10  Law of Large Numbers

    • 11  Problems
  • Probability Distributions
    • 12  Bernoulli Distribution
    • 13  Binomial Distribution
    • 14  Geometric Distribution
    • 15  Negative Binomial Distribution
    • 16  Hypergeometric Distribution
    • 17  Multinomial Distribution
    • 18  Poisson Distribution

    • 19  Uniform Distribution (Rectangular Distribution)
    • 20  Normal Distribution (Gaussian Distribution)
    • 21  Gaussian Naive Bayes Classifier
    • 22  Chi Distribution
    • 23  Chi-squared Distribution (1 parameter)
    • 24  Chi-squared Distribution (2 parameters)
    • 25  Student t-Distribution
    • 26  Fisher F-Distribution
    • 27  Exponential Distribution
    • 28  Lognormal Distribution
    • 29  Gamma Distribution
    • 30  Beta Distribution
    • 31  Weibull Distribution
    • 32  Pareto Distribution
    • 33  Inverse Gamma Distribution
    • 34  Rayleigh Distribution
    • 35  Erlang Distribution
    • 36  Logistic Distribution
    • 37  Laplace Distribution
    • 38  Gumbel Distribution
    • 39  Cauchy Distribution
    • 40  Triangular Distribution
    • 41  Power Distribution
    • 42  Beta Prime Distribution
    • 43  Sample Correlation Distribution
    • 44  Dirichlet Distribution
    • 45  Generalized Extreme Value (GEV) Distribution
    • 46  Frechet Distribution
    • 47  Noncentral t Distribution
    • 48  Noncentral F Distribution
    • 49  Inverse Chi-Squared Distribution
    • 50  Maxwell-Boltzmann Distribution
    • 51  Distribution Relationship Map

    • 52  Problems
  • Descriptive Statistics & Exploratory Data Analysis
    • 53  Types of Data
    • 54  Datasheets

    • 55  Frequency Plot (Bar Plot)
    • 56  Frequency Table
    • 57  Contingency Table
    • 58  Binomial Classification Metrics
    • 59  Confusion Matrix
    • 60  ROC Analysis

    • 61  Stem-and-Leaf Plot
    • 62  Histogram
    • 63  Data Quality Forensics
    • 64  Quantiles
    • 65  Central Tendency
    • 66  Variability
    • 67  Skewness & Kurtosis
    • 68  Concentration
    • 69  Notched Boxplot
    • 70  Scatterplot
    • 71  Pearson Correlation
    • 72  Rank Correlation
    • 73  Partial Pearson Correlation
    • 74  Simple Linear Regression
    • 75  Moments
    • 76  Quantile-Quantile Plot (QQ Plot)
    • 77  Normal Probability Plot
    • 78  Probability Plot Correlation Coefficient Plot (PPCC Plot)
    • 79  Box-Cox Normality Plot
    • 80  Kernel Density Estimation
    • 81  Bivariate Kernel Density Plot
    • 82  Conditional EDA: Panel Diagnostics
    • 83  Bootstrap Plot (Central Tendency)
    • 84  Survey Scores Rank Order Comparison
    • 85  Cronbach Alpha

    • 86  Equi-distant Time Series
    • 87  Time Series Plot (Run Sequence Plot)
    • 88  Mean Plot
    • 89  Blocked Bootstrap Plot (Central Tendency)
    • 90  Standard Deviation-Mean Plot
    • 91  Variance Reduction Matrix
    • 92  (Partial) Autocorrelation Function
    • 93  Periodogram & Cumulative Periodogram

    • 94  Problems
  • Hypothesis Testing
    • 95  Normal Distributions revisited
    • 96  The Population
    • 97  The Sample
    • 98  The One-Sided Hypothesis Test
    • 99  The Two-Sided Hypothesis Test
    • 100  When to use a one-sided or two-sided test?
    • 101  What if \(\sigma\) is unknown?
    • 102  The Central Limit Theorem (revisited)
    • 103  Statistical Test of the Population Mean with known Variance
    • 104  Statistical Test of the Population Mean with unknown Variance
    • 105  Statistical Test of the Variance
    • 106  Statistical Test of the Population Proportion
    • 107  Statistical Test of the Standard Deviation \(\sigma\)
    • 108  Statistical Test of the difference between Means -- Independent/Unpaired Samples
    • 109  Statistical Test of the difference between Means -- Dependent/Paired Samples
    • 110  Statistical Test of the difference between Variances -- Independent/Unpaired Samples

    • 111  Hypothesis Testing for Research Purposes
    • 112  Decision Thresholds, Alpha, and Confidence Levels
    • 113  Bayesian Inference for Decision-Making
    • 114  One Sample t-Test
    • 115  Skewness & Kurtosis Tests
    • 116  Paired Two Sample t-Test
    • 117  Wilcoxon Signed-Rank Test
    • 118  Unpaired Two Sample t-Test
    • 119  Unpaired Two Sample Welch Test
    • 120  Two One-Sided Tests (TOST) for Equivalence
    • 121  Mann-Whitney U test (Wilcoxon Rank-Sum Test)
    • 122  Bayesian Two Sample Test
    • 123  Median Test based on Notched Boxplots
    • 124  Chi-Squared Tests for Count Data
    • 125  Kolmogorov-Smirnov Test
    • 126  One Way Analysis of Variance (1-way ANOVA)
    • 127  Kruskal-Wallis Test
    • 128  Two Way Analysis of Variance (2-way ANOVA)
    • 129  Repeated Measures ANOVA
    • 130  Friedman Test
    • 131  Testing Correlations
    • 132  A Note on Causality

    • 133  Problems
  • Regression Models
    • 134  Simple Linear Regression Model (SLRM)
    • 135  Multiple Linear Regression Model (MLRM)
    • 136  Logistic Regression
    • 137  Generalized Linear Models
    • 138  Multinomial and Ordinal Logistic Regression
    • 139  Cox Proportional Hazards Regression
    • 140  Conditional Inference Trees
    • 141  Leaf Diagnostics for Conditional Inference Trees
    • 142  Conditional Random Forests
    • 143  Hypothesis Testing with Linear Regression Models (from a Practical Point of View)

    • 144  Problems
  • Introduction to Time Series Analysis
    • 145  Case: the Market of Health and Personal Care Products
    • 146  Decomposition of Time Series
    • 147  Ad hoc Forecasting of Time Series
  • Box-Jenkins Analysis
    • 148  Introduction to Box-Jenkins Analysis
    • 149  Theoretical Concepts
    • 150  Stationarity
    • 151  Identifying ARMA parameters
    • 152  Estimating ARMA Parameters and Residual Diagnostics
    • 153  Forecasting with ARIMA models
    • 154  Intervention Analysis
    • 155  Cross-Correlation Function
    • 156  Transfer Function Noise Models
    • 157  General-to-Specific Modeling
  • Model Building Strategies
    • 158  Introduction to Model Building Strategies
    • 159  Manual Model Building
    • 160  Model Validation
    • 161  Regularization Methods
    • 162  Hyperparameter Optimization Strategies
    • 163  Guided Model Building in Practice
    • 164  Diagnostics, Revision, and Guided Forecasting
    • 165  Leakage, Target Encoding, and Robust Regression
  • References
  • Appendices
    • Appendices
    • A  Method Selection Guide
    • B  Presentations and Teaching Materials
    • C  R Language Concepts for Statistical Computing
    • D  Matrix Algebra
    • E  Standard Normal Table (Gaussian Table)
    • F  Critical values of Student’s \(t\) distribution with \(\nu\) degrees of freedom
    • G  Upper-tail critical values of the \(\chi^2\)-distribution with \(\nu\) degrees of freedom
    • H  Lower-tail critical values of the \(\chi^2\)-distribution with \(\nu\) degrees of freedom

Table of contents

  • 141.1 Definition
  • 141.2 Why This Matters
  • 141.3 Practical Workflow
  • 141.4 R Module
    • 141.4.1 Public website
    • 141.4.2 RFC
  • 141.5 Example: Regression Leaves for Maximum Heart Rate
  • 141.6 A Minimal R Example of Leaf-Wise Summaries
  • 141.7 Interpreting Leaf Reliability
  • 141.8 Pros & Cons
    • 141.8.1 Pros
    • 141.8.2 Cons
  • 141.9 Task
  1. Regression Models
  2. 141  Leaf Diagnostics for Conditional Inference Trees

141  Leaf Diagnostics for Conditional Inference Trees

141.1 Definition

Leaf diagnostics extend the Conditional Inference Tree workflow (Chapter 140) by evaluating the distribution of a continuous outcome inside each terminal node (leaf).

Instead of reading only leaf means or predicted values, this approach inspects:

  • center,
  • spread,
  • tail behavior,
  • and distributional fit quality

within each predicted segment.

141.2 Why This Matters

In regression settings, two leaves can have similar average predictions but very different reliability characteristics. For leaf \(\ell\) with outcome \(Y\):

\[ \mathrm{Var}(Y\mid \ell) \]

may differ strongly across leaves. This is evidence of conditional variance heterogeneity (a heteroskedasticity-like pattern in the prediction structure).

141.3 Practical Workflow

  1. Fit a ctree with a continuous outcome.
  2. Use terminal nodes as panels.
  3. Compare leaf-wise quantiles, variability, and shape diagnostics.
  4. Flag leaves with high spread, strong skewness, or heavy tails.
  5. Communicate predictions with leaf-specific reliability comments.

For predictive interpretation, this diagnostic should preferably be repeated on a holdout/test sample.

141.4 R Module

141.4.1 Public website

Leaf diagnostics are available through the Conditional EDA app in Tree mode:

  • https://shiny.wessa.net/ConditionalEDA

141.4.2 RFC

In RFC, open “Descriptive / Conditional EDA”, switch to Tree mode, select a continuous outcome, and choose exogenous variables for the ctree split structure.

141.5 Example: Regression Leaves for Maximum Heart Rate

The example below models maxheartrateNum using ageNum and thalassemiaLabel, then compares leaf diagnostics panel-by-panel.

Interactive Shiny app (click to load).
Open in new tab

The embedded app uses the heart dataset. The short R example below uses synthetic data so that the same leaf-diagnostics logic can be reproduced directly in code.

141.6 A Minimal R Example of Leaf-Wise Summaries

The same idea can be demonstrated without the app. The code below fits a simple regression tree, records the terminal node for each observation, and then summarizes the response distribution within each leaf.

library(party)

set.seed(321)
n <- 180
age <- sample(25:80, n, replace = TRUE)
risk_group <- factor(sample(c("low", "medium", "high"), n, replace = TRUE,
                            prob = c(0.35, 0.4, 0.25)))

max_rate <- 185 -
  0.55 * age -
  ifelse(risk_group == "high", 18, ifelse(risk_group == "medium", 8, 0)) +
  rnorm(n, sd = ifelse(risk_group == "high", 11, ifelse(risk_group == "medium", 7, 4)))

leaf_data <- data.frame(age = age, risk_group = risk_group, max_rate = max_rate)

leaf_tree <- ctree(
  max_rate ~ age + risk_group,
  data = leaf_data,
  controls = ctree_control(mincriterion = 0.95, minsplit = 20, minbucket = 10)
)

leaf_id <- predict(leaf_tree, type = "node")

leaf_summary <- aggregate(
  max_rate ~ leaf_id,
  data = transform(leaf_data, leaf_id = leaf_id),
  FUN = function(x) c(n = length(x),
                      mean = mean(x),
                      sd = sd(x),
                      q25 = quantile(x, 0.25),
                      median = median(x),
                      q75 = quantile(x, 0.75))
)

leaf_stats <- as.data.frame(leaf_summary$max_rate)
names(leaf_stats) <- c("n", "mean", "sd", "q25", "median", "q75")

leaf_summary <- data.frame(
  leaf = leaf_summary$leaf_id,
  leaf_stats,
  row.names = NULL
)

knitr::kable(
  transform(
    leaf_summary,
    mean = round(mean, 1),
    sd = round(sd, 1),
    q25 = round(q25, 1),
    median = round(median, 1),
    q75 = round(q75, 1)
  ),
  caption = "Leaf-wise summaries for a simple regression tree"
)
Leaf-wise summaries for a simple regression tree
leaf n mean sd q25 median q75
5 11 171.5 5.0 168.3 170.3 173.0
6 13 160.1 6.0 157.9 163.1 163.7
9 18 161.7 4.0 159.9 160.4 163.4
10 13 153.9 4.6 151.5 153.8 155.6
11 34 149.5 8.3 141.5 151.1 154.5
12 25 140.8 11.3 132.3 139.8 147.2
15 10 149.7 4.0 146.7 150.8 151.8
16 10 142.5 4.8 139.4 142.7 145.5
19 10 142.5 9.4 138.2 143.5 148.0
20 17 134.7 6.7 131.1 135.8 138.1
21 19 129.5 10.4 121.4 129.1 138.0
Code
boxplot(
  max_rate ~ factor(leaf_id),
  data = transform(leaf_data, leaf_id = leaf_id),
  col = "grey85",
  border = "grey40",
  xlab = "Terminal node",
  ylab = "Maximum heart rate",
  main = "Outcome spread differs across leaves"
)
Figure 141.1: Leaf-wise outcome distributions for a regression tree

This is the key idea of leaf diagnostics in one picture: the tree may split the data usefully, but some terminal nodes are still much more variable than others. That difference should appear in how you describe the reliability of predictions.

Detailed interpretation of the synthetic tree example:

  1. The terminal nodes separate high- and low-capacity heart-rate segments; the center of max_rate is materially different across leaves.
  2. The younger low-risk leaves (for example, nodes 5 and 9) have the highest centers and relatively small spread, so their local predictions are comparatively stable.
  3. The medium-risk middle-age leaf (node 11) already shows visibly broader dispersion than the nearby low-risk leaves, even though its center still looks clinically plausible.
  4. The high-risk leaves (especially nodes 12 and 21) have the lowest centers and the widest spread, making them the least stable prediction segments in the figure.
  5. Interpretation rule: do not treat all leaves as equally reliable. The same tree can contain both well-behaved and weakly-behaved prediction bins.

141.7 Interpreting Leaf Reliability

When comparing leaves:

  • low spread + mild asymmetry -> more stable local predictions,
  • high spread + heavy tails -> higher uncertainty and lower local reliability,
  • severe skew/tails -> consider robust summaries or transformation-sensitive interpretation.

This does not invalidate the tree; it improves how predictions are communicated and where model refinement should focus.

141.8 Pros & Cons

141.8.1 Pros

  • adds uncertainty context to leaf predictions,
  • improves interpretability of regression trees,
  • helps identify segments requiring robust modeling decisions.

141.8.2 Cons

  • requires enough observations per leaf,
  • can be misread as causal subgroup effects,
  • should not replace out-of-sample performance validation.

141.9 Task

Using Tree mode in Conditional EDA:

  1. Fit a ctree for a continuous outcome with at least three predictors.
  2. Identify one leaf with relatively stable distributional properties and one with unstable properties.
  3. Explain how this affects the reliability of predictions for those two segments.
140  Conditional Inference Trees
142  Conditional Random Forests

© 2026 Patrick Wessa. Provided as-is, without warranty.

Feedback: e-mail | Anonymous contributions: click to copy (Sats) | click to copy (XMR)

Cookie Preferences