random_tcherry: Constructs a random third order t-cherry tree

Description Usage Arguments Details Value Author(s) Examples

View source: R/random_tcherry.R

Description

Constructs a random third order t-cherry tree with conditional probability tables.

Usage

1
random_tcherry(n, n_levels, noise = NULL)

Arguments

n

The number of variables/nodes in the graph.

n_levels

Vector with the number of levels for each variable.

noise

If given makes it possible to control the strength of dependencies. See details.

Details

The third order t-cherry tree is constructed by choosing the first edge at random. Then a random node is chosen to be connected to the two nodes of a random already existing edge.

The constructed conditional probability tables are based on the structure of a bayesian network with the third order t-cherry tree as domain graph. The two nodes firstly added to the graph are considered to have no parents in the bayesian network, and their probability tables are constructed by normalised random tables. All other nodes have exactly two parents. If the argument noise is NULL these conditional probability tables are also made by random tables with proper normalisation.

If noise is given, the conditional probability table is first constructed for the child given one parent and a specific level for the second parent. The conditional probability tables for the remaining levels of the second parent is then constructed from the first one by adding uniformly distributed simulations in the interval [0 ; noise] before normalisation.

This makes it possible to control whether the child should depend strongly on one parent and not necessarily both. For instance noise = 0 would mean that the child is actually independent of the second parent given the first.

Value

A list containing the following components:

Author(s)

Katrine Kirkeby, enir_tak@hotmail.com

Maria Knudsen, mariaknudsen@hotmail.dk

Ninna Vihrs, ninnavihrs@hotmail.dk

Examples

1
2
3
set.seed(43)
graph <- random_tcherry(5, rep(2, 5))
graph_noise <- random_tcherry(5, rep(2, 5), noise = 0.01)

nvihrs14/tcherry documentation built on Aug. 1, 2020, 6:25 p.m.