cnNew: New catNetwork

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/def.R

Description

Creates a new catNetwork with specified nodes, categories, parent sets and probability structure.

Usage

1
cnNew(nodes, cats, pars, probs=NULL, p.delta1=0.01, p.delta2=0.01, dagonly=FALSE)

Arguments

nodes

a vector of nodes names

cats

a list of node categories

pars

a list of node pars

probs

a list of probabilities

p.delta1

a numeric

p.delta2

a numeric

dagonly

a logical, selects between catNetwork and DAG

Details

If probs is not specified, then a random probability model is assigned with conditional probability values in the union of the intervals [p.delta1, 0.5-p.delta2] and [0.5+p.delta2, 1-p.delta1]. Because of the nested list hierarchy of the probability structure, specifying the probability argument explicitly can be very elaborated task for large networks. In the following example we create a small network with only three nodes. The first node has no pars and only its marginal distribution is given, c(0.2,0.8). Note that all inner most vectors in the probs argument, such as (0.4,0.6), represent conditional distributions and thus sum to 1.

Value

A catNetwork object.

Author(s)

N. Balov

See Also

catNetwork-class, cnRandomCatnet

Examples

1
2
3
4
5
6
7
8
9
cnet <- cnNew(
	nodes = c("a", "b", "c"),
	cats = list(c("1","2"), c("1","2"), c("1","2")), 
	pars = list(NULL, c(1), c(1,2)), 
	probs = list(	c(0.2,0.8), 
			list(c(0.6,0.4),c(0.4,0.6)), 
			list(list(c(0.3,0.7),c(0.7,0.3)), 
			list(c(0.9,0.1),c(0.1,0.9))))
	)

sdnet documentation built on May 29, 2017, 1:32 p.m.