20.82 Conditional Regression Tree

We can also build a regression tree using (Hothorn et al. 2026).

model <- ctree(formula=form, data=ds[tr, vars])
model
## 
## Model formula:
## risk_mm ~ rain_today + temp_3pm + temp_9am + cloud_3pm + cloud_9am + 
##     pressure_3pm + pressure_9am + humidity_3pm + humidity_9am + 
##     wind_speed_3pm + wind_speed_9am + wind_dir_3pm + wind_dir_9am + 
##     wind_gust_speed + wind_gust_dir + sunshine + evaporation + 
##     rainfall + max_temp + min_temp
## 
## Fitted party:
## [1] root
## |   [2] rainfall <= 21.2
## |   |   [3] humidity_3pm <= 83
## |   |   |   [4] humidity_3pm <= 67
## |   |   |   |   [5] pressure_3pm <= 1008.9
## |   |   |   |   |   [6] humidity_3pm <= 51
## |   |   |   |   |   |   [7] sunshine <= 7.7
## |   |   |   |   |   |   |   [8] wind_dir_3pm <= E: 4.899 (n=500, err=NA)
## |   |   |   |   |   |   |   [9] wind_dir_3pm > E
## |   |   |   |   |   |   |   |   [10] humidity_3pm <= 25: 1.173 (n=250, err=NA)
## |   |   |   |   |   |   |   |   [11] humidity_3pm > 25
## |   |   |   |   |   |   |   |   |   [12] wind_gust_speed <= 91
## |   |   |   |   |   |   |   |   |   |   [13] cloud_3pm <= 6
## |   |   |   |   |   |   |   |   |   |   |   [14] pressure_3pm <= 994.6: 6.192 (n=24, err=1995.2)
## |   |   |   |   |   |   |   |   |   |   |   [15] pressure_3pm > 994.6: 1.988 (n=541, err=NA)
## |   |   |   |   |   |   |   |   |   |   [16] cloud_3pm > 6: 3.375 (n=462, err=NA)
## |   |   |   |   |   |   |   |   |   [17] wind_gust_speed > 91: 10.207 (n=30, err=13460.8)
## |   |   |   |   |   |   [18] sunshine > 7.7
## |   |   |   |   |   |   |   [19] humidity_3pm <= 28
## |   |   |   |   |   |   |   |   [20] wind_gust_speed <= 56
## |   |   |   |   |   |   |   |   |   [21] humidity_3pm <= 16
## |   |   |   |   |   |   |   |   |   |   [22] humidity_3pm <= 13
## |   |   |   |   |   |   |   |   |   |   |   [23] wind_gust_speed <= 46: 0.023 (n=998, err=NA)
## |   |   |   |   |   |   |   |   |   |   |   [24] wind_gust_speed > 46: 0.083 (n=524, err=NA)
## |   |   |   |   |   |   |   |   |   |   [25] humidity_3pm > 13: 0.224 (n=641, err=NA)
## |   |   |   |   |   |   |   |   |   [26] humidity_3pm > 16
## |   |   |   |   |   |   |   |   |   |   [27] wind_gust_speed <= 37: 0.167 (n=610, err=NA)
## |   |   |   |   |   |   |   |   |   |   [28] wind_gust_speed > 37: 0.589 (n=1913, err=NA)
## |   |   |   |   |   |   |   |   [29] wind_gust_speed > 56
## |   |   |   |   |   |   |   |   |   [30] humidity_3pm <= 15: 0.428 (n=745, err=NA)
## |   |   |   |   |   |   |   |   |   [31] humidity_3pm > 15
## |   |   |   |   |   |   |   |   |   |   [32] wind_dir_3pm <= NE: 4.214 (n=127, err=NA)
## |   |   |   |   |   |   |   |   |   |   [33] wind_dir_3pm > NE
## |   |   |   |   |   |   |   |   |   |   |   [34] sunshine <= 9
## |   |   |   |   |   |   |   |   |   |   |   |   [35] wind_speed_3pm <= 30
## |   |   |   |   |   |   |   |   |   |   |   |   |   [36] wind_gust_speed <= 89: 1.816 (n=303, err=NA)
....

References

Hothorn, Torsten, Kurt Hornik, Carolin Strobl, and Achim Zeileis. 2026. Party: A Laboratory for Recursive Partytioning. https://codeberg.org/thothorn/party.


Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0