Learn R Programming

ddgraph (version 1.16.0)

biased.bn.fit: Random network with a biased degree distribution

Description

A version of random.bn.fit which generates a graph based on degree distribution and beta distribution for probabilities

Usage

biased.bn.fit(nodes, beta.est, in.degree.distr, bn.graph)

Arguments

nodes
character vector of node names
beta.est
the beta distribution parameters for different degrees of a node. Should be a list where [[2]] corresponds to 2-dimenstional contingency table (i.e. one parent, one output). It contains a data.frame with columns shape1, shape2 for the beta distribution, and rows are degrees of freedom (in this case 2, when P(Out=0|Parent=0) and P(Out=0|Parent=1))
in.degree.distr
a vector with degree distribution for all the nodes in the network (names are ignored, and degree is randomly sampled from this vector)
bn.graph
if the graph structure is already available, then the graph structure in object of class "bn"

Value

bn - a bn object which contains the structure and bn.fit - a bn.fit object with filled in conditional probabilities

Examples

Run this code
nodes = letters[1:5]
beta.est = list(data.frame(shape1=2,shape2=3), data.frame(shape1=c(2,4), shape2=c(5,2)), data.frame(shape1=c(1,2,3,4), shape2=c(3,2,1,2)))
in.degree.distr = c(0, 1, 1, 2, 2)
# make a random graph using these parameters
biased.bn.fit(nodes, beta.est, in.degree.distr)

Run the code above in your browser using DataLab