ChowLiu: Determines the Chow-Liu tree for data

Description Usage Arguments Value Author(s) See Also Examples

View source: R/CL.R

Description

Determines the structure and the conditional probability tables for the Chow-Liu tree fitted to data.

Usage

1
ChowLiu(data, root = NULL, bayes_smooth = 0, CPTs = TRUE, ...)

Arguments

data

The data the tree structure should be based on.

root

An optional argument, choosing a userspecified root for the tree.

bayes_smooth

Additional cell counts for bayesian estimation of probability tables.

CPTs

A logical value indicating whether conditional probability tables should be estimated from data or not.

...

Additional parameters passed to MI2.

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

See Also

MI2 for mutual information, CPT for probability tables and is_acyclic for a test for cycles.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
set.seed(43)
var1 <- c(sample(c(1, 2), 50, replace = TRUE))
var2 <- var1 + c(sample(c(1, 2), 50, replace = TRUE))
var3 <- var1 + c(sample(c(0, 1), 50, replace = TRUE,
                        prob = c(0.9, 0.1)))
var4 <- c(sample(c(1, 2), 50, replace = TRUE))

data <- data.frame("var1" = as.character(var1),
                   "var2" = as.character(var2),
                   "var3" = as.character(var3),
                   "var4" = as.character(var4))

CL <- ChowLiu(data, root = 'var1', smooth = 0.1)

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