| depsubtree {stagedtrees} | R Documentation |
Extract dependency subtree
Description
Extract the dependency subtree of a staged tree with respect to a variable
Usage
depsubtree(object, var, other_stages = c("NA", "indep", "full"))
Arguments
object |
an object of class |
var |
the name of one of the variable of the staged event tree. |
other_stages |
how to set stages for other variables (if any). |
Details
The dependency sub-tree is a staged event tree which is
sufficient to describe the conditional distribution of the variable
var given its predecessors in the original tree represented by
object.
In particular the preceding variables are restricted to the
parents of var in the minimal-DAG obtained with
as_parentslist. This is the minimal set of
variables which contexts are sufficient to fully represent the
conditional distribution of var.
Stages for variables different from var are either set to
NA, or to the full or indep model, depending on other_stages.
Value
an object of class sevt representing the
dependency sub-tree.
Examples
mod <- stages_kmeans(full(Titanic), k = 2)
par(mfrow = c(1, 2))
plot(mod, main = "staged tree")
plot(depsubtree(mod, "Age"), main = "dependency subtree for Age")
par(mfrow = c(1, 1))