plot.stree: Plot function for a stree object

Description Usage Arguments Details References See Also Examples

View source: R/plot.stree.R

Description

Draw a tree structure plot for stree object. The plot includes main parameters of STREE model.

Usage

1
2
  ## S3 method for class 'stree'
plot(x, shape = 1, main = "stree", ...)

Arguments

x

stree object, typically result of stree.

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 stree plot.

...

Further arguments to be passed to plot.stree

Details

This function is a method for the generic function plot, for objects of class stree.

References

Zhang, H. and Singer, B. (1999), Recursive partitioning in the health sciences, Springer Verlag.

See Also

stree

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# load "macs" library
library("macs")

# construct STREE model
set.seed(1234)
data <- data.frame(r = runif(1000, 1, 10), c = rbinom(1000, 1, 0.5),
                   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 <- stree(data, family = "likelihood")

# plot result of stree
plot(result, main = "example of stree plot")
plot(result, shape = 2)

macs documentation built on Oct. 9, 2019, 5:05 p.m.

Related to plot.stree in macs...