Description Usage Arguments Value References See Also Examples
View source: R/BayesTreePrior.R
Generate a tree and returns the number of bottom nodes and depth in the general case (Case #4).
1 2 |
alpha |
base parameter of the tree prior, α \in [0,1). |
beta |
power parameter of the tree prior, beta ≥q 0. |
X |
data.frame of the design matrix. |
depth |
depth of the current node, depth ≥q 0. |
minpart |
the minimum number of observations required in one of the child to be able to split, minpart>0. |
pvars |
vector of probabilities for the choices of variables to split (Will automatically be normalized so that the sum equal to 1). It must be twice as large as the number of variables when missingdummy is TRUE. |
MIA |
set to TRUE if you want Missing Incorporated in Attributes (MIA) imputation to be used. |
missingdummy |
set to TRUE if you have dummy coded the NAs. |
Returns a vector containing the number of bottom nodes and depth
Twala, B. E. T. H., Jones, M. C., & Hand, D. J. (2008). Good methods for coping with missing data in decision trees. Pattern Recognition Letters, 29(7), 950-956.
NumBotMaxDepth_inf
, NumBotMaxDepth
1 2 3 4 5 6 7 8 9 10 11 | if (requireNamespace("MASS", quietly = TRUE)) {
x1 = MASS::mcycle$times
x1[sample(1:length(x1), 20)] <- NA
x2= MASS::mcycle$accel
x2[sample(1:length(x2), 20)] <- NA
X = cbind(x1, x2)
results1 = NumBotMaxDepthX(.95,.5, data.frame(X), minpart=5)
X_dummies = is.na(X) + 0
results2 = NumBotMaxDepthX(.95,.5, data.frame(cbind(X,X_dummies)), minpart=5, MIA=TRUE,
missingdummy=TRUE)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.