as_parentslist: Obtain the equivalent DAG as list of parents

View source: R/8-conversion-functions.R

as_parentslistR 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, ...)

Arguments

x

an R object.

...

additional parameters.

order

order of the variables, usually a topological order.

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 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 

stagedtrees documentation built on April 29, 2022, 1:06 a.m.