Print fitted regression tree

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

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)
#> ID: 1, gender = { Female, NA } #> ID: 2, Size: 118 [Terminal] #> Outcome Models: #> y1 Est SE #> X1 1.02 #> z.0 -0.18 0.13 #> z.1 1 0.19 #> - - - - - - - - - - - - - - #> y2 Est SE #> X2 1.19 #> z.0 -0.06 0.13 #> z.1 2.06 0.18 #> - - - - - - - - - - - - - - #> ID: 1, gender = { Male } #> ID: 3, Size: 82 [Terminal] #> Outcome Models: #> y1 Est SE #> X1 0.96 #> z.0 0.2 0.14 #> z.1 -0.23 0.2 #> - - - - - - - - - - - - - - #> y2 Est SE #> X2 0.97 #> z.0 0.17 0.15 #> z.1 -0.04 0.21 #> - - - - - - - - - - - - - -
printTree(mrsobj, digits = 2, details=FALSE)
#> ID: 1, gender = { Female, NA } #> ID: 2, Size: 118 [Terminal] #> ID: 1, gender = { Male } #> ID: 3, Size: 82 [Terminal]