Description Usage Arguments Details Value Author(s) References See Also Examples
View source: R/weight_junction_tree.R
Calculates the weight of a junction tree with the given cliques and separators.
1 | weight_junction_tree(cliques, separators, data, ...)
|
cliques, separators |
Lists containing cliques and separators given by variable names. |
data |
A data frame or matrix containing the variables. |
... |
Additional arguments passed to |
The weight of the junction tree is calculated as
∑ MI(clique)-∑ MI(separator)
where the sum is over all cliques and separators respectively.
The weight of the junction tree.
Katrine Kirkeby, enir_tak@hotmail.com
Maria Knudsen, mariaknudsen@hotmail.dk
Ninna Vihrs, ninnavihrs@hotmail.dk
EKTShyptcherry
MIk
for mutual infomation for k variables.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | set.seed(43)
var1 <- c(sample(c(1, 2), 100, replace = TRUE))
var2 <- var1 + c(sample(c(1, 2), 100, replace = TRUE))
var3 <- var1 + c(sample(c(0, 1), 100, replace = TRUE,
prob = c(0.9, 0.1)))
var4 <- c(sample(c(1, 2), 100, replace = TRUE))
data <- data.frame("var1" = as.character(var1),
"var2" = as.character(var2),
"var3" = as.character(var3),
"var4" = as.character(var4))
cliques <- list(c("var1", "var2", "var4"), c("var1", "var3", "var4"))
separators <- list(c("var1", "var4"))
weight_junction_tree(cliques, separators, data, smooth = 0.001)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.