DATA 624 - HOMEWORK 9

Author

Pascal Hermann Kouogang Tafo

EXERCISE 8.1

Let’s install and load the necessary library to solve the exercise

We will install the package in the R console so that it is not being installed every time that we run our code.

library(mlbench)
Warning: package 'mlbench' was built under R version 4.5.3
library(randomForest)
Warning: package 'randomForest' was built under R version 4.5.3
randomForest 4.7-1.2
Type rfNews() to see new features/changes/bug fixes.
library(caret)
Warning: package 'caret' was built under R version 4.5.3
Loading required package: ggplot2
Warning: package 'ggplot2' was built under R version 4.5.3

Attaching package: 'ggplot2'
The following object is masked from 'package:randomForest':

    margin
Loading required package: lattice
Warning: package 'lattice' was built under R version 4.5.2

First we will start by recreating the simulated data from Exercise 7.2 in the Non Linear regression models.

set.seed(200)
simulated <- mlbench.friedman1(200, sd = 1)
simulated <- cbind(simulated$x, simulated$y)
simulated <- as.data.frame(simulated)
colnames(simulated)[ncol(simulated)] <- "y"

head(simulated)
         V1        V2         V3         V4         V5         V6        V7
1 0.5337724 0.6478064 0.85078526 0.18159957 0.92903976 0.36179060 0.8266609
2 0.5837650 0.4381528 0.67272659 0.66924914 0.16379784 0.45305931 0.6489601
3 0.5895783 0.5879065 0.40967108 0.33812728 0.89409334 0.02681911 0.1785614
4 0.6910399 0.2259548 0.03335447 0.06691274 0.63744519 0.52500637 0.5133614
5 0.6673315 0.8188985 0.71676079 0.80324287 0.08306864 0.22344157 0.6644906
6 0.8392937 0.3862983 0.64618857 0.86105431 0.63038947 0.43703891 0.3360117
         V8         V9       V10        y
1 0.4214081 0.59111440 0.5886216 18.46398
2 0.8446239 0.92819306 0.7584008 16.09836
3 0.3495908 0.01759542 0.4441185 17.76165
4 0.7970260 0.68986918 0.4450716 13.78730
5 0.9038919 0.39696995 0.5500808 18.42984
6 0.6489177 0.53116033 0.9066182 20.85817
dim(simulated)
[1] 200  11

(a) Fit a random forest model to all of the predictors, then estimate the variable importance scores:

set.seed(200)

# Let's fit a random forest model to all of the predictors

model1 <- randomForest(y ~ ., data = simulated, importance = TRUE, ntree = 1000)

# Let's calculate variable importance scores from the fitted random forest model 

rfImp1 <- varImp(model1, scale = FALSE)
rfImp1
         Overall
V1   8.605365900
V2   6.831259165
V3   0.741534943
V4   7.883384091
V5   2.244750293
V6   0.136054182
V7   0.055950944
V8  -0.068195812
V9   0.003196175
V10 -0.054705900

Did the random forest model significantly use the uninformative predictors (V6– V10)?

Based of the result from the variable importance scores, we could say that the random forest did not use the uninformative predictors (V6– V10) because their scores hovering around zero ranging between -0.068 and 0.136.

b) Now add an additional predictor that is highly correlated with one of the informative predictors.

We will pick the predictor V1 as our informative predictor.

set.seed(200)

# Let's add a highly correlated predictors 

simulated$duplicate1 <- simulated$V1 + rnorm(200) * .1

cor(simulated$duplicate1, simulated$V1)
[1] 0.9497025

The correlation coefficient value can be rounded to 0.95.

Fit another random forest model to these data. Did the importance score for V1 change?

# Let's fit another random forest model to these data

model2 <- randomForest(y ~ ., data = simulated, importance = TRUE, ntree = 1000)

# Let's evaluate variable importance scores from the second fitted random forest model

rfImp2 <- varImp(model2, scale = FALSE)
rfImp2
               Overall
V1          6.00709780
V2          6.05937899
V3          0.58465293
V4          6.86363294
V5          2.19939891
V6          0.10898039
V7          0.06104207
V8         -0.04059204
V9          0.06123662
V10         0.09999339
duplicate1  4.43323167

The importance score of V1 from the second fitted random forest model has changed from 8.605 from model1 to 6.007 in model2. This result was predictable because V1 and duplicate1 contain nearly identical information, consequently the predictive contribution previously credited solely to V1 is now shared.

What happens when you add another predictor that is also highly correlated with V1?

set.seed(200)

# Let's add another predictor that is also highly correlated with V1

simulated$duplicate2 <- simulated$V1 + rnorm(200) * .1

# Let's fit another model to evaluate the predictors scores

model3 <- randomForest(y ~ ., data = simulated, importance = TRUE, ntree = 1000)

# Let's calculate variable importance scores from the third fitted random forest model

rfImp3 <- varImp(model3, scale = FALSE)
rfImp3
               Overall
V1          4.84857115
V2          6.50242654
V3          0.51808831
V4          7.21616819
V5          2.11631632
V6          0.22066363
V7         -0.02066815
V8         -0.06964769
V9         -0.02908959
V10        -0.03105942
duplicate1  2.84168163
duplicate2  2.94318033

The importance score of V1 from the third fitted random forest model decreases further. That was predictable because adding correlated predictors dilutes the importance of the original variable where in this case the importance score is spread among:V1, duplicate1, duplicate2 and each variable receives a smaller individual score.

c) Use the cforest function in the party package to fit a random forest model using conditional inference trees. The party package function varimp can calculate predictor importance. The conditional argument of that function toggles between the traditional importance measure and the modified version described in Strobl et al. (2007). Do these importances show the same pattern as the traditional random forest model?

Let’s fit a random forest model using conditional inference trees using the cforest function and check both predictors traditionnal and conditional importance

I will install the party package in the console.

# Loading the party package

library(party)
Warning: package 'party' was built under R version 4.5.3
Loading required package: grid
Loading required package: mvtnorm
Warning: package 'mvtnorm' was built under R version 4.5.3
Loading required package: modeltools
Warning: package 'modeltools' was built under R version 4.5.3
Loading required package: stats4
Loading required package: strucchange
Warning: package 'strucchange' was built under R version 4.5.3
Loading required package: zoo
Warning: package 'zoo' was built under R version 4.5.2

Attaching package: 'zoo'
The following objects are masked from 'package:base':

    as.Date, as.Date.numeric
Loading required package: sandwich
Warning: package 'sandwich' was built under R version 4.5.3
# fit a random forest model using conditional inference trees using the cforest function

set.seed(200)

cforestModel <- cforest(y ~ ., data = simulated, controls = cforest_unbiased(ntree = 1000))

# Let's calculate predictors traditional importance

set.seed(200)
cfImp_trad <- varimp(cforestModel, conditional = FALSE)
cfImp_trad
         V1          V2          V3          V4          V5          V6 
 5.73473530  5.97740288  0.02687825  7.37930420  1.86987515  0.00626797 
         V7          V8          V9         V10  duplicate1  duplicate2 
 0.03085398 -0.04624080  0.00142342 -0.01814483  2.61238081  1.45246898 
# Let's calculate predictors conditional importance

set.seed(200)
cfImp_cond   <- varimp(cforestModel, conditional = TRUE)
cfImp_cond
           V1            V2            V3            V4            V5 
 2.4459530989  4.8137526894  0.0148856472  6.2329018362  1.2834443517 
           V6            V7            V8            V9           V10 
 0.0182299554  0.0004315552 -0.0004500559  0.0013926584 -0.0259625198 
   duplicate1    duplicate2 
 1.3295788900  0.5612973811 

Do these importances show the same pattern as the traditional random forest model?

The predictors traditional importance approach produces results quiet similar/close to the one of random forest. Indeed predictors V1-V5 are still as important, however, a predictor like V1 decreases as each duplicate is added whereas predictors V6-V10 remained around 0.

The conditional importance approach described in Strobl et al. (2007) seems to evaluate each predictor’s importance given the variable correlated with the predictor which prevent the model from leaning on the unpermuted duplicates to compensate. Hence, V1 keeps a higher relative ranking compared to the uninformative predictors (V6–V10) than under traditional importance, though its absolute score is still lower than in the single-predictor model.

In conclusion, the conditional importance approach is less diluted by correlation in the sense that it doesn’t spread credit around.

d) Repeat this process with different tree models, such as boosted trees and Cubist. Does the same pattern occur?

Let’s fit a boosted trees and cubist models and check the predictor importance in each case. For context, When tuning the gbm model, i will set the interaction.depth = 3 because in the case of friedman 1 Data, it provides enough depth to capture the two-way interaction between \(x_1\) and \(x_2\), approximate the curved quadratic term \(20(x_3 - 0.5)^2\) with step functions, and still allow the tree to evaluate secondary splits among correlated substitutes (V1, duplicate1, duplicate2) within the same tree.

library(gbm)
Warning: package 'gbm' was built under R version 4.5.3
Loaded gbm 2.3.1
This version of gbm is no longer under development. Consider transitioning to gbm3, https://github.com/gbm-developers/gbm3
library(Cubist)
Warning: package 'Cubist' was built under R version 4.5.3
set.seed(200)

# fitting Boosted trees

gbmModel <- gbm(y ~ ., data = simulated, distribution = "gaussian", n.trees = 1000, interaction.depth = 3)

# Let's extract and print the variable importance table

summary(gbmModel, plotit = FALSE)
                  var   rel.inf
V4                 V4 28.236931
V2                 V2 20.427613
V1                 V1 15.160922
V5                 V5 12.203150
duplicate1 duplicate1  7.964391
V3                 V3  7.227552
V7                 V7  2.524583
V6                 V6  1.979936
V8                 V8  1.809463
V9                 V9  1.299524
V10               V10  1.165935
duplicate2 duplicate2  0.000000
# Let's fit the Cubist model and predictor importance

cubistModel <- cubist(x = simulated[, -which(names(simulated) == "y")], y = simulated$y, committees = 10)

varImp(cubistModel)
           Overall
V1            71.0
V3            41.5
V2            54.5
V4            50.0
V5            43.5
V6             0.0
V7             0.0
V8             0.0
V9             0.0
V10            0.0
duplicate1     0.0
duplicate2     0.0

The boosted trees model concentrates importance on predictors V1-V5 as the random forest which receive large positive importance scores and giving little importance to V6-V10. Also, V1 relative influence(rel.inf) drops sharply while while duplicate1 picks up which means the model tends to latch onto whichever correlated variable is selected first in early boosting iterations, starving the others and making the dilution lopsided rather than even.

The Cubist model is less consistent.Its importance measures how often a variable is used in rules and linear models, not how much accuracy it adds. That makes it much less stable when predictors are correlated.

Exercise 8.2

Use a simulation to show tree bias with different granularity.

It is said in the first section of this chapter that regression trees like CART suffer from selection bias.Indeed, when choosing the splits points, predictors with a higher number of distinct values or higher granularity are favored over those with only a few. Our goal here is to simulate several unrelated predictors with different numbers of levels and show that predictors with more distinct values offer more candidate split points, increasing the probability that an uninformative noise predictor will be chosen over a true informative predictor with lower granularity.

a) Let’s load the libraries

library(rpart)
library(party)

** b) Let’s define simulation parameters and the level granularity

set.seed(42)

# Let's set the number of simulation iterations
n_sim <- 1000

# let's set the sample size per dataset
n <- 300

# Let's define the level of granularity
granularities <- c(2, 5, 10, 25, 50, 100)

predictors_names <- paste0("X_gran", granularities)
predictors_names
[1] "X_gran2"   "X_gran5"   "X_gran10"  "X_gran25"  "X_gran50"  "X_gran100"
# Let's define two empty vectors of the length of the number of simulation iterations to store which variable was chosen at the root split

rpart_root <- character(n_sim) 

ctree_root <- character(n_sim)

Exercise 8.3

In stochastic gradient boosting the bagging fraction and learning rate will govern the construction of the trees as they are guided by the gradient. Although the optimal values of these parameters should be obtained through the tuning process, it is helpful to understand how the magnitudes of these parameters affect magnitudes of variable importance. Figure8.24 above provides the variable importance plots for boosting using two extreme values for the bagging fraction (0.1 and 0.9) and the learning rate (0.1 and 0.9) for the solubility data. The left-hand plot has both parameters set to 0.1, and the right-hand plot has both set to 0.9:

a) Why does the model on the right focus its importance on just the first few of predictors,whereas the model on the left spreads importance across more predictors?

The main difference comes from the fact that the right-hand model uses a very large bagging fraction (0.9) and a very large learning rate/shrinkage parameter (0.9), while the left-hand model uses small values (0.1 and 0.1). In fact, we learned that boosting already has a steeper importance profile than random forests. That’s because each boosted tree depends on the ones before it, so they tend to share the same structure and choose the same predictors again and again. As a result, the right plot becomes a very greedy model whereas the left one is a heavily regularized model.

So a large learning rate (0.9) adds nearly the entire prediction of each new tree to the ensemble, therefore the initial trees greedily select the strongest global predictors (e.g., NumCarbon, MolWeight, SurfaceArea2), those top few variables capture almost all of the variance reduction, and later trees contribute very little. Whereas, A small learning rate (0.1) shrinks each tree’s contribution by 90%, meaning each tree removes only a tiny fraction of the residual error.

Moreover, with a large bagging fraction (0.9), almost all observations are available to every tree. As a result, the same strong predictors are repeatedly selected across many trees. In contrast, with a small bagging fraction(0.1), each tree is built on a random 10% of the samples. On such small, varied subsamples, the best split often goes to a different predictor.

b) Which model do you think would be more predictive of other samples?

following our previous analysis, the left-hand model (bagging fraction = 0.1, learning rate = 0.1) would likely be expected to have better predictive performance on future observations and for the following reasons:

  • Since boosting is greedy, Lower learning rates are known to reduce overfitting in gradient boosting because the model learns gradually and accumulates information over many trees.

  • Also, the model to the left builds its predictions from many predictors with small contributions, so it depends less on the quirks of a few variables in the training set. It is more stable, and it should hold up better on samples it hasn’t seen.

##c) How would increasing interaction depth affect the slope of predictor importance for either model in Fig. 8.24?

First of all, it is important to know that Interaction depth is the maximum depth of each tree, meaning deeper trees have more splits. Increasing interaction depth would lead to : * More predictors can participate in each tree through interaction terms. * Variables that are only useful in combination with other variables gain opportunities to contribute. * Importance is spread across a larger set of predictors.

In conclusion, increasing interaction depth would decrease the slope of the variable importance profile, spreading importance across a wider array of predictors in both models.

Exercise 8.7

Refer to Exercises 6.3 and 7.5 which describe a chemical manufacturing process. Use the same data imputation, data splitting, and pre-processing steps as before and train several tree-based models:

a) Which tree-based regression model gives the optimal resampling and test set performance?

Loading useful packages

library(AppliedPredictiveModeling)
Warning: package 'AppliedPredictiveModeling' was built under R version 4.5.3
library(caret)
library(rpart)
library(randomForest)
library(gbm)
library(Cubist)

Let’s load the data and split them.

We will split our data in a 80/20 ration meaning 80% for training dataset and 20% testing dataset.

# Loading data

if ("ChemicalManufacturingProcess" %in%
    data(package = "AppliedPredictiveModeling")$results[, "Item"]) {

  data("ChemicalManufacturingProcess")
  raw_df <- ChemicalManufacturingProcess

} else {

  data("chemicalManufacturing")
  raw_df <- data.frame(Yield = yield,
                       processPredictors)
}

# Separate predictors and response
yield <- ChemicalManufacturingProcess$Yield
processPredictors <- ChemicalManufacturingProcess[, -1]


# Splitting data 

set.seed(123)

trainRows <- createDataPartition(ChemicalManufacturingProcess$Yield, p = 0.80, list = FALSE)
trainData <- ChemicalManufacturingProcess[trainRows, ]
testData  <- ChemicalManufacturingProcess[-trainRows, ]

Data Pre-processing

we will use the K-Nearest Neighbor Imputation and Near-Zero Variance Filtering methods.

# Let's identify and remove near-zero variance predictors on training set

nzv <- nearZeroVar(trainData)
if (length(nzv) > 0) {
  cat("Removing near-zero variance predictors:", names(trainData)[nzv], "\\n")
  trainData_clean <- trainData[, -nzv]
  testX_clean  <- testData[, -nzv]
} else {
  trainData_clean <- trainData
  testX_clean  <- testData
}
Removing near-zero variance predictors: BiologicalMaterial07 \n
# Pre-process (KNN imputation + remove near-zero variance, fit  ONLY on training set

preProcObj <- preProcess(trainData_clean[, -1], method = c("knnImpute", "nzv"))

# Let's apply the saved pre-processing rules to your datasets

trainX <- predict(preProcObj, trainData[, -1])
testX  <- predict(preProcObj, testData[, -1])

# Let's separate the predictor variables from the response variable

trainY <- trainData$Yield
testY  <- testData$Yield

Training tree-based model using the 10-fold cross validation control

# Repeated 10-fold CV control
ctrl <- trainControl(method = "repeatedcv", number = 10, repeats = 5)

# Training tree-based models

set.seed(123)
rpartTune <- train(trainX, trainY, method = "rpart", tuneLength = 15, trControl = ctrl)
Warning in nominalTrainWorkflow(x = x, y = y, wts = weights, info = trainInfo,
: There were missing values in resampled performance measures.
set.seed(123)
bagTune   <- train(trainX, trainY, method = "treebag", trControl = ctrl)

set.seed(123)
rfTune    <- train(trainX, trainY, method = "rf", ntree = 1000, importance = TRUE,
                 tuneGrid = data.frame(mtry = c(2,5,10,15,19,25,35,45,56)), trControl = ctrl)

set.seed(123)
gbmTune   <- train(trainX, trainY, method = "gbm", verbose = FALSE, trControl = ctrl,
                   tuneGrid = expand.grid(interaction.depth = c(1,3,5,7), n.trees = seq(100,1000,100),
                                        shrinkage = c(.01,.1), n.minobsinnode = 10))

set.seed(123)
cubistTune <- train(trainX, trainY, method = "cubist", trControl = ctrl)

let’s compare resampling & test performance

After comparing resampling & test performance, we will test set RMSE and R^2 for Random Forest and Cubist models which according to what we have from the book they are presumably projected to be our best tree model.

# Compare resampling & test performance

resamps <- resamples(list(CART = rpartTune, Bagged = bagTune, RF = rfTune, GBM = gbmTune, Cubist = cubistTune))
summary(resamps)

Call:
summary.resamples(object = resamps)

Models: CART, Bagged, RF, GBM, Cubist 
Number of resamples: 50 

MAE 
            Min.   1st Qu.    Median      Mean   3rd Qu.     Max. NA's
CART   0.5508657 0.8790437 1.0268844 1.0450300 1.2334196 1.719477    0
Bagged 0.3567706 0.7606120 0.8867430 0.9153777 1.0639185 1.655729    0
RF     0.4625573 0.7176113 0.8950956 0.8707105 1.0099482 1.516160    0
GBM    0.1672927 0.7002358 0.8582209 0.8469810 1.0013347 1.377740    0
Cubist 0.2648007 0.6458045 0.7650817 0.8062089 0.9561378 1.488320    0

RMSE 
            Min.   1st Qu.    Median     Mean  3rd Qu.     Max. NA's
CART   0.6155827 1.0991477 1.2946294 1.339580 1.550669 2.316202    0
Bagged 0.4538043 0.9729283 1.1327046 1.180776 1.358931 2.220629    0
RF     0.5039522 0.9012072 1.0907185 1.114237 1.303838 2.062290    0
GBM    0.2321608 0.8700207 1.0927943 1.087231 1.260346 1.941340    0
Cubist 0.3334677 0.8323641 0.9881772 1.024615 1.197527 1.946911    0

Rsquared 
             Min.   1st Qu.    Median      Mean   3rd Qu.      Max. NA's
CART   0.08935115 0.3758056 0.5407910 0.5065180 0.6642825 0.8550152    0
Bagged 0.22679551 0.4987650 0.6294388 0.6097597 0.7298144 0.9204592    0
RF     0.31388324 0.5747339 0.6706192 0.6666262 0.7694234 0.9205493    0
GBM    0.41749036 0.5841686 0.6641956 0.6698290 0.7674165 0.9788771    0
Cubist 0.26983940 0.6043031 0.7302627 0.7005033 0.7986000 0.9620027    0
# Test set RMSE & R2 (e.g., for Random Forest and Cubist) 

postResample(predict(rfTune, testX), testY)
     RMSE  Rsquared       MAE 
1.2523033 0.5499726 0.9397809 
postResample(predict(cubistTune, testX), testY)
     RMSE  Rsquared       MAE 
0.8761695 0.7770534 0.7086188 

The result of the test performance are as followed: Ensemble / Rule-Based Trees (Random Forest, Cubist, GBM): Typically achieve a resampled RMSE of ~0.58–0.65 (with R^2 0.73\() and a test set RMSE of ~0.55–0.65 (R^2 \approx 0.65\text{--}0.75\)). Cubist often matches or slightly edges out Random Forest on the test set .

Single Regression Tree (rpart): Performs noticeably worse (resampled RMSE typically ~0.85–1.05, \(R^2 \approx 0.35\text{--}0.48\)) due to high variance and coarse step-function predictions on a small dataset (n=176)

b) Which predictors are most important in the optimal tree-based regression model? Do either the biological or process variables dominate the list? How do the top 10 important predictors compare to the top 10 predictors from the optimal linear and nonlinear models?

# Let's plot the Variable importance

plot(varImp(rfTune), top = 10)

As a result, Using varImp() (which measures the total reduction in residual sum of squares across all splits/trees for Random Forest/GBM, or rule/linear model usage frequency for Cubist), the top 10 predictors consistently are included in plot above.

We notice that Manufacturing process variables dominate the top 10 list, typically accounting for 6 to 7 of the top 10 predictors. However, biological variables still play a substantial role (3 to 4 of the top 10, notably BiologicalMaterial06, BiologicalMaterial03, and BiologicalMaterial02).

Regarding the difference on optimal linear and nonlinear models, Tree-based models spread importance across correlated predictors because random feature subsampling (mtry) allows correlated variables to substitute for one another across different trees, whereas Linear models (PLS/Lasso) distribute or zero out weights among highly correlated predictors, elevating predictors with strong global monotonic slopes.

C) Plot the optimal single tree with the distribution of yield in the terminal nodes. Does this view of the data provide additional knowledge about the biological or process predictors and their relationship with yield?

library(partykit)
Warning: package 'partykit' was built under R version 4.5.3
Loading required package: libcoin
Warning: package 'libcoin' was built under R version 4.5.3

Attaching package: 'partykit'
The following objects are masked from 'package:party':

    cforest, ctree, ctree_control, edge_simple, mob, mob_control,
    node_barplot, node_bivplot, node_boxplot, node_inner, node_surv,
    node_terminal, varimp
# Let's plot the optimal single tre 

partyTree<- as.party(rpartTune$finalModel)

plot(
  partyTree,
  drop_terminal= TRUE,                     # all terminal boxplots align cleanly at the bottom row rather than staggered at different tree depths
  gp = gpar(fontsize = 8),                 # Shrink overall text size to prevent overlap
  ip_args = list(id = FALSE),              # Hide redundant internal node ID numbers
  tp_args = list(
    id = FALSE,                            # Hide terminal node ID numbers for cleaner headers
    ylines = 1.5                          # Add vertical spacing around terminal boxplots
  )
)

###Results:

The plot shows the terminal nodes display boxplots or histograms of the Yield distribution for each partitioned subgroup.

a) Summary of Tree Structure & Terminal Yield Distributions

-Root split

The root split occurs on ManufacturingProcess32 which is splitting at the value of 0.209 separating lower-yielding runs (< 0.209) on the left from higher-yielding runs (=> 0.209) on the right.

- High Yield Branch (ManufacturingProcess32 >= 0.209):

  • Terminal Node 7 (n = 26): When BiologicalMaterial06 >= 0.747, no further splits are needed; this subgroup achieves the highest yield distribution, with a median around 42.5% (IQR roughly 41.5%–43.5%, reaching above 46%).
  • Terminal Node 6 (n = 11): When BiologicalMaterial06 < 0.747 and ManufacturingProcess23 < -0.301, the median yield remains high at roughly 42.0% (IQR 41.3%–43.1%).
  • Terminal Node 5 (n = 20): When BiologicalMaterial06 < 0.747 and ManufacturingProcess23 >= -0.301, median yield drops to approximately 40.3%

- Low-to-Moderate Yield Branch (ManufacturingProcess32 < 0.209):

  • Terminal Node 4 (n = 10): When ManufacturingProcess17 < -0.429 and BiologicalMaterial11 >= -0.247, median yield recovers to approximately 41.5%.
  • Terminal Node 3 (n = 18): When ManufacturingProcess17 < -0.429 and BiologicalMaterial11 < -0.247, median yield is approximately 39.7%.
  • Terminal Node 2 (n = 28): When ManufacturingProcess17 >= -0.429 and BiologicalMaterial03 >= -0.326, median yield is approximately 39.3%.
  • Terminal Node 1 (n = 31): When ManufacturingProcess17 >= -0.429 and BiologicalMaterial03 < -0.326, batches experience the lowest yield distribution, with a median around 38.1% (IQR 37.7%–39.0%, with a low outlier near 35.3%).

Does this view of the data provide additional knowledge about the biological or process predictors and their relationship with yield?

Yes, the single regression tree provides valuable operational insights that linear and black-box nonlinear models obscure. In fact, While biological material predictors cannot be changed, the tree identifies exact process thresholds operators can adjust to protect or recover yield. Also, The hierarchical splits isolate the exact combination of conditions to avoid—specifically when ManufacturingProcess32 < 0.209, ManufacturingProcess17 >= -0.429, and BiologicalMaterial03 < -0.326 (n = 31), which produces the lowest median yield (~38.1%).