#install.packages("party")
library(party)
## Loading required package: grid
## Loading required package: mvtnorm
## Loading required package: modeltools
## Loading required package: stats4
## Loading required package: strucchange
## Loading required package: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
## Loading required package: sandwich
library(MASS)
data(Boston)
names(Boston)
## [1] "crim" "zn" "indus" "chas" "nox" "rm" "age"
## [8] "dis" "rad" "tax" "ptratio" "black" "lstat" "medv"
fit <- ctree(medv ~ rm + ptratio ,
data=Boston)
plot(fit)

summary(fit)
## Length Class Mode
## 1 BinaryTree S4
data("iris")
names(iris)
## [1] "Sepal.Length" "Sepal.Width" "Petal.Length" "Petal.Width"
## [5] "Species"
fit2 <- ctree(Species ~ Sepal.Length + Petal.Length + Sepal.Width ,
data=iris)
plot(fit2)
