Description Usage Arguments Details References See Also Examples
Draw a tree structure plot for ctree
object. The plot includes main parameters of RTREE model.
1 2 |
x |
|
shape |
has two options: 1 or 2. Determine the shape of tree where '1' uses circle and square to denote nodes while '2' uses point to represent nodes. |
main |
title to |
... |
Further arguments to be passed to |
This function is a method for the generic function plot, for objects of class ctree
.
Zhang, H. and Singer, B. (1999), Recursive partitioning in the health sciences, Springer Verlag.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # load "macs" library
library("macs")
# construct RTREE model
set.seed(1234)
data <- data.frame(y = sample(1:3, 1000, replace = TRUE),
n = as.factor(sample(1:4, 1000, replace = TRUE,
prob = c(0.1, 0.3, 0.2, 0.4))),
o1 = sample(1:50, 1000, replace = TRUE),
o2 = sample(1:30, 1000, replace = TRUE),
o3 = sample(1:10, 1000, replace = TRUE),
o4 = sample(1:60, 1000, replace = TRUE),
o5 = sample(1:20, 1000, replace = TRUE),
o6 = sample(1:40, 1000, replace = TRUE))
head(data)
result <- rtree(data, method = "entropy", alpha = 0.01, cost = c(1, 1, 1))
result
# plot result of rtree
plot(result, main = "example of ctree plot")
plot(result, shape = 2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.