mle.kraftMcMillan: Apply the Kraft-McMillian Inequality using a specific...

View source: R/mle.kraftMcMillan.r

mle.kraftMcMillanR Documentation

Apply the Kraft-McMillian Inequality using a specific encoding algorithm.

Description

A power analysis of the encoding algorithm using to encode subsets of S in G.

Usage

mle.kraftMcMillan(G, k, multiNode = FALSE)

Arguments

G

- A character vector of all node names in the background knowledge graph.

k

- The size of the node name subsets of G.

multiNode

- Boolean, indicating whether to use the multi-node diffusion encoding algorithm (TRUE) or the single-node diffusion encoding algorithm (FALSE). Default is FALSE.

Value

IA - a list of bitlengths associated with all outcomes in the N choose K outcome space, with the names of the list elements the node names of the encoded nodes

Examples

G = list(A=0, B=0, C=0, D=0, E=0, F=0, G=0)
names(G) = tolower(names(G))
adj_mat = rbind(c(0,2,1,0,0,0,0), #A's neighbors
                c(2,0,1,0,0,0,0), #B's neighbors
                c(1,1,0,1,0,0,0), #C's neighbors
                c(0,0,1,0,2,1,0), #D's neighbors
                c(0,0,0,2,0,2,1), #E's neighbors
                c(0,0,0,1,2,0,1), #F's neighbors
                c(0,0,0,0,1,1,0)  #G's neighbors
                )
rownames(adj_mat) = names(G)
colnames(adj_mat) = names(G)
adjacency_matrix = list(adj_mat)
IA = mle.kraftMcMillian(G, 2)
# Power to find effects is
sum(2^-unlist(IA))

BRL-BCM/CTDext documentation built on May 7, 2022, 5:31 a.m.