Description Usage Arguments Details Value Author(s) Examples
View source: R/random_tcherry.R
Constructs a random third order t-cherry tree with conditional probability tables.
1 | random_tcherry(n, n_levels, noise = NULL)
|
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. |
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.
A list containing the following components:
adj_matrix
The adjacency matrix for the third order t-cherry tree.
CPTs
Conditional probability tables for a corresponding
bayesian network.
Katrine Kirkeby, enir_tak@hotmail.com
Maria Knudsen, mariaknudsen@hotmail.dk
Ninna Vihrs, ninnavihrs@hotmail.dk
1 2 3 | set.seed(43)
graph <- random_tcherry(5, rep(2, 5))
graph_noise <- random_tcherry(5, rep(2, 5), noise = 0.01)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.