| as_sevt {stagedtrees} | R Documentation |
Coerce to sevt
Description
Convert to an equivalent object of class sevt.
Usage
as_sevt(x, ...)
## S3 method for class 'bn.fit'
as_sevt(x, order = NULL, ...)
## S3 method for class 'bn'
as_sevt(x, order = NULL, values = NULL, ...)
## S3 method for class 'parentslist'
as_sevt(x, order = NULL, values = NULL, ...)
Arguments
x |
an R object. |
... |
additional parameters to be used by specific methods. |
order |
order of the variables. |
values |
the values for each variable, the sample space. |
Details
In as_sevt.bn.fit the order
argument, if provided, must be a topological order of the
bn.fit object (no check is performed). If the order is not provided
a topological order will be used (the one returned by
bnlearn::node.ordering).
In as_sevt.parentslist the order
argument, if provided, must be a topological order of the
corresponding DAG (no check is performed).
If the order is not provided
names(x) is used.
The values parameter is used to specify the sample space
of each variable. For a parentslist object created with
as_parentslist from an object of class sevt,
it is, usually, not needed to specify the values parameter,
since the sample space is saved in the parentslist object.
Value
the equivalent object of class sevt.
Examples
model <- stages_hclust(full(Titanic), k = 2)
plot(model)
pl <- as_parentslist(model)
model2 <- as_sevt(pl)
plot(model2) ## this is a super-model of the first staged tree
## we can check it with
inclusions_stages(model, model2)