20.82 Conditional Regression Tree

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

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 <= 82
## |   |   |   [4] humidity_3pm <= 66
## |   |   |   |   [5] pressure_3pm <= 1008.9
## |   |   |   |   |   [6] humidity_3pm <= 51
## |   |   |   |   |   |   [7] sunshine <= 7.9
## |   |   |   |   |   |   |   [8] cloud_3pm <= 6
## |   |   |   |   |   |   |   |   [9] pressure_3pm <= 997: 5.208 (n=62, err=2777.8)
## |   |   |   |   |   |   |   |   [10] pressure_3pm > 997: 2.457 (n=833, err=NA)
## |   |   |   |   |   |   |   [11] cloud_3pm > 6
## |   |   |   |   |   |   |   |   [12] wind_dir_3pm <= NNE: 7.304 (n=150, err=NA)
## |   |   |   |   |   |   |   |   [13] wind_dir_3pm > NNE: 3.060 (n=593, err=NA)
## |   |   |   |   |   |   [14] sunshine > 7.9
## |   |   |   |   |   |   |   [15] humidity_3pm <= 31
## |   |   |   |   |   |   |   |   [16] wind_gust_speed <= 56
## |   |   |   |   |   |   |   |   |   [17] humidity_3pm <= 18: 0.182 (n=1833, err=NA)
## |   |   |   |   |   |   |   |   |   [18] humidity_3pm > 18
## |   |   |   |   |   |   |   |   |   |   [19] sunshine <= 8.3: 4.600 (n=20, err=3803.5)
## |   |   |   |   |   |   |   |   |   |   [20] sunshine > 8.3
## |   |   |   |   |   |   |   |   |   |   |   [21] sunshine <= 10.5: 0.742 (n=1411, err=NA)
## |   |   |   |   |   |   |   |   |   |   |   [22] sunshine > 10.5
## |   |   |   |   |   |   |   |   |   |   |   |   [23] wind_dir_3pm <= NNE: 1.446 (n=39, err=701.2)
## |   |   |   |   |   |   |   |   |   |   |   |   [24] wind_dir_3pm > NNE: 0.052 (n=511, err=NA)
## |   |   |   |   |   |   |   |   [25] wind_gust_speed > 56
## |   |   |   |   |   |   |   |   |   [26] humidity_3pm <= 17
## |   |   |   |   |   |   |   |   |   |   [27] wind_gust_speed <= 74
## |   |   |   |   |   |   |   |   |   |   |   [28] humidity_9am <= 74: 0.412 (n=560, err=NA)
## |   |   |   |   |   |   |   |   |   |   |   [29] humidity_9am > 74: 3.086 (n=7, err=358.7)
## |   |   |   |   |   |   |   |   |   |   [30] wind_gust_speed > 74: 1.147 (n=135, err=1211.3)
## |   |   |   |   |   |   |   |   |   [31] humidity_3pm > 17
## |   |   |   |   |   |   |   |   |   |   [32] temp_3pm <= 27
## |   |   |   |   |   |   |   |   |   |   |   [33] pressure_3pm <= 995.2: 4.000 (n=15, err=303.5)
## |   |   |   |   |   |   |   |   |   |   |   [34] pressure_3pm > 995.2
## |   |   |   |   |   |   |   |   |   |   |   |   [35] wind_dir_9am <= ESE: 1.370 (n=114, err=NA)
## |   |   |   |   |   |   |   |   |   |   |   |   [36] wind_dir_9am > ESE
....

References

Hothorn, Torsten, Kurt Hornik, Carolin Strobl, and Achim Zeileis. 2025. Party: A Laboratory for Recursive Partytioning. http://party.R-forge.R-project.org.


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