printTree: Print fitted regression tree

Description Usage Arguments Value Examples

View source: R/print.R

Description

Print fitted regression tree

Usage

1
printTree(mrsobj, digits = 3, details = TRUE, ...)

Arguments

mrsobj

MrSGUIDE object

digits

digits pass to coefficient

details

whether to print fitting details

...

parameter pass to print_node

Value

print tree information into console

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
library(MrSGUIDE)
set.seed(1234)

N = 200
np = 3

numX <- matrix(rnorm(N * np), N, np) ## numerical features
gender <- sample(c('Male', 'Female'), N, replace = TRUE)
country <- sample(c('US', 'UK', 'China', 'Japan'), N, replace = TRUE)

z <- sample(c(0, 1), N, replace = TRUE) # Binary treatment assignment

y1 <- numX[, 1] + 1 * z * (gender == 'Female') + rnorm(N)
y2 <- numX[, 2] + 2 * z * (gender == 'Female') + rnorm(N)

train <- data.frame(numX, gender, country, z, y1, y2)
role <- c(rep('n', 3), 'c', 'c', 'r', 'd', 'd')

mrsobj <- MrSFit(dataframe = train, role = role)
printTree(mrsobj, digits = 2, details=TRUE)
printTree(mrsobj, digits = 2, details=FALSE)

MrSGUIDE documentation built on Oct. 23, 2020, 5:19 p.m.