as_parentslist {stagedtrees} | R Documentation |
Obtain the equivalent DAG as list of parents
Description
Convert to the equivalent representation as list of parents.
Usage
as_parentslist(x, ...)
## S3 method for class 'bn'
as_parentslist(x, order = NULL, ...)
## S3 method for class 'bn.fit'
as_parentslist(x, order = NULL, ...)
## S3 method for class 'sevt'
as_parentslist(x, silent = FALSE, ...)
Arguments
x |
an R object. |
... |
additional parameters. |
order |
order of the variables, usually a topological order. |
silent |
if function should be silent. |
Details
The output of this function is an object of class
parentslist
which is one of the possible encoding for
a directed graph. This is mainly an internal class and its
specification can be changed in the future.
For example, now it may also include information on the
sample space of the variables and the context/partial/local
independences.
In as_parentslist.sevt
, if a context-specific or a local-partial independence is detected
a message is printed (if silent = FALSE
) and the minimal super-model is returned.
Value
An object of class parentslist
for which a
print method exists.
Basically a list with
one entries for each variable with fields:
-
parents
The parents of the variable. -
context
Where context independences are detected. -
partial
Where partial independences are detected. -
local
Where no context/partial independences are detected, but local independences are present. -
values
values for the variable.
See Also
print.parentslist
and
as.character.parentslist
for the parenthesis-encoding of the
DAG structure and the asymmetric independences.
Examples
model <- stages_hclust(full(Titanic), k = 2)
pl <- as_parentslist(model)
pl$Age