Description Usage Arguments Value Examples
Plot MrSGUIDE regression tree
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | plotTree(
mrsobj,
digits = 3,
height = "600px",
width = "100%",
nodefontSize = 16,
edgefontSize = 14,
minNodeSize = 15,
maxNodeSize = 30,
nodeFixed = FALSE,
edgeColor = "#8181F7",
highlightNearest = list(enabled = TRUE, degree = list(from = 50000, to = 0), hover =
FALSE, algorithm = "hierarchical"),
collapse = list(enabled = FALSE, fit = TRUE, resetHighlight = TRUE, clusterOptions =
list(fixed = TRUE, physics = FALSE)),
alphaInd = 3
)
|
mrsobj |
MrSGUIDE object |
digits |
digits for split threshold |
height |
figure height |
width |
figure width |
nodefontSize |
node font size |
edgefontSize |
edge font size |
minNodeSize |
minimal node size |
maxNodeSize |
maximum node size |
nodeFixed |
whether you can drag node |
edgeColor |
edge color |
highlightNearest |
choose node will highlight nearby |
collapse |
list, collapse or not using double click on a node |
alphaInd |
1 is original alpha, 2 is individual level alpha, 3 is overall alpha |
A list contains plot figure
treeplot |
The tree plot uses |
nodeTreat |
A data frame contain each elements used for tree plot. |
trtPlot |
A treatment effects plot of each node. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 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)
plotObj <- plotTree(mrsobj)
#plotObj$treePlot
plotObj$nodeTreat ## node information
plotObj$trtPlot ## treatment effect plot
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.