Data Preprocessing for Extensible Trees.
A routine for preprocessing data before an extensible tree can be grown by
extree_fit
.
extree_data(formula, data, subset, na.action = na.pass, weights, offset, cluster, strata, scores = NULL, yx = c("none", "matrix"), ytype = c("vector", "data.frame", "matrix"), nmax = c(yx = Inf, z = Inf), ...)
formula |
a formula describing the model of the form |
data |
an optional data.frame containing the variables in the model. |
subset |
an optional vector specifying a subset of observations to be used in the fitting process. |
na.action |
a function which indicates what should happen when the data contain missing values. |
weights |
an optional vector of weights. |
offset |
an optional offset vector. |
cluster |
an optional factor describing clusters. The interpretation depends on the specific tree algorithm. |
strata |
an optional factor describing strata. The interpretation depends on the specific tree algorithm. |
scores |
an optional named list of numeric scores to be assigned to
ordered factors in the |
yx |
a character indicating if design matrices shall be computed. |
ytype |
a character indicating how response variables shall be stored. |
nmax |
a numeric vector of length two with the maximal number of
bins in the response and |
... |
additional arguments. |
This internal functionality will be the basis of implementations of other
tree algorithms in future versions. Currently, only ctree
relies on
this function.
An object of class extree_data
.
data("iris") ed <- extree_data(Species ~ Sepal.Width + Sepal.Length | Petal.Width + Petal.Length, data = iris, nmax = c("yx" = 25, "z" = 10), yx = "matrix") ### the model.frame mf <- model.frame(ed) all.equal(mf, iris[, names(mf)]) ### binned y ~ x part model.frame(ed, yxonly = TRUE) ### binned Petal.Width ed[[4, type = "index"]] ### response ed$yx$y ### model matrix ed$yx$x
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.