20.83 Conditional Regression Tree

We can also build a regression tree using .

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 <= 14.4
## |   |   [3] humidity_3pm <= 81
## |   |   |   [4] humidity_3pm <= 66
## |   |   |   |   [5] pressure_3pm <= 1008.9
## |   |   |   |   |   [6] humidity_3pm <= 51
## |   |   |   |   |   |   [7] sunshine <= 7.7
## |   |   |   |   |   |   |   [8] wind_dir_3pm <= NNE
## |   |   |   |   |   |   |   |   [9] cloud_3pm <= 6: 3.319 (n=132, err=NA)
## |   |   |   |   |   |   |   |   [10] cloud_3pm > 6: 7.285 (n=142, err=NA)
## |   |   |   |   |   |   |   [11] wind_dir_3pm > NNE
## |   |   |   |   |   |   |   |   [12] wind_gust_speed <= 91
## |   |   |   |   |   |   |   |   |   [13] pressure_3pm <= 1006.1: 3.006 (n=727, err=NA)
## |   |   |   |   |   |   |   |   |   [14] pressure_3pm > 1006.1
## |   |   |   |   |   |   |   |   |   |   [15] rainfall <= 7.6
## |   |   |   |   |   |   |   |   |   |   |   [16] pressure_9am <= 1011.9: 1.292 (n=424, err=NA)
## |   |   |   |   |   |   |   |   |   |   |   [17] pressure_9am > 1011.9: 3.464 (n=109, err=NA)
## |   |   |   |   |   |   |   |   |   |   [18] rainfall > 7.6: 9.585 (n=13, err=4814.3)
## |   |   |   |   |   |   |   |   [19] wind_gust_speed > 91: 8.692 (n=39, err=13729.6)
## |   |   |   |   |   |   [20] sunshine > 7.7
## |   |   |   |   |   |   |   [21] humidity_3pm <= 24
## |   |   |   |   |   |   |   |   [22] wind_gust_speed <= 56
## |   |   |   |   |   |   |   |   |   [23] humidity_3pm <= 13
## |   |   |   |   |   |   |   |   |   |   [24] wind_dir_3pm <= WSW
## |   |   |   |   |   |   |   |   |   |   |   [25] min_temp <= 28: 0.008 (n=764, err=NA)
## |   |   |   |   |   |   |   |   |   |   |   [26] min_temp > 28: 0.179 (n=19, err=7.6)
## |   |   |   |   |   |   |   |   |   |   [27] wind_dir_3pm > WSW: 0.139 (n=403, err=NA)
## |   |   |   |   |   |   |   |   |   [28] humidity_3pm > 13
## |   |   |   |   |   |   |   |   |   |   [29] wind_gust_speed <= 44: 0.238 (n=1089, err=NA)
## |   |   |   |   |   |   |   |   |   |   [30] wind_gust_speed > 44: 0.544 (n=786, err=NA)
## |   |   |   |   |   |   |   |   [31] wind_gust_speed > 56
## |   |   |   |   |   |   |   |   |   [32] humidity_3pm <= 17
## |   |   |   |   |   |   |   |   |   |   [33] wind_gust_speed <= 69: 0.461 (n=494, err=NA)
## |   |   |   |   |   |   |   |   |   |   [34] wind_gust_speed > 69
## |   |   |   |   |   |   |   |   |   |   |   [35] evaporation <= 16: 0.847 (n=257, err=NA)
## |   |   |   |   |   |   |   |   |   |   |   [36] evaporation > 16: 6.240 (n=10, err=1002.0)
....

References

Hothorn, Torsten, Kurt Hornik, Carolin Strobl, and Achim Zeileis. 2023. 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