cpt_list: Conditional probability list

View source: R/api_compile.R

cpt_listR Documentation

Conditional probability list

Description

A check and conversion of cpts to be used in the junction tree algorithm

Usage

cpt_list(x, g = NULL)

## S3 method for class 'list'
cpt_list(x, g = NULL)

## S3 method for class 'data.frame'
cpt_list(x, g)

Arguments

x

Either a named list with cpts in form of array-like object(s) where names must be the child node or a data.frame

g

Either a directed acyclic graph (DAG) as an igraph object or a decomposable graph as an igraph object. If x is a list, g must be NULL. The procedure then deduce the graph from the conditional probability tables.

Examples


library(igraph)
el <- matrix(c(
"A", "T",
"T", "E",
"S", "L",
"S", "B",
"L", "E",
"E", "X",
"E", "D",
"B", "D"),
 nc = 2,
 byrow = TRUE
)

g <- igraph::graph_from_edgelist(el) 
cl <- cpt_list(asia, g)

print(cl)
dim_names(cl)
names(cl)
plot(get_graph(cl))

jti documentation built on April 12, 2022, 9:05 a.m.