partykit-master/tests/regtest-ctree.R

suppressWarnings(RNGversion("3.5.2"))

## package
library("partykit")

## iris data
data("iris", package = "datasets")
irisct <- ctree(Species ~ ., data = iris)
print(irisct)
table(fit = predict(irisct), true = iris$Species)

## airquality data
data("airquality", package = "datasets")
airq <- subset(airquality, !is.na(Ozone))
airqct <- ctree(Ozone ~ ., data = airq)
print(airqct)
sum((airq$Ozone - predict(airqct))^2)
tulliapadellini/energytree documentation built on May 14, 2020, 8:06 p.m.