paths: Generate 'assign' and 'w.assign'.

Description Usage Arguments Value Examples

Description

For every root node in DAG defined by map, paths circles over all possible path graphs, picks up the one that consists of the most unmarked node, and then marks the nodes in the path graph that have been selected. paths won't move to the next root node, until all the descendant nodes of the current root have been marked.

Usage

1
paths(map, var, w = NULL)

Arguments

map

Matrix of n.edges-by-2 dimension, where n.edges is the number of directed edges in DAG. The first column has indices of nodes that edges directing from, whereas the second column gives the indices of nodes the corresponding edges directing towards. If a node indexed i does not have edges linked to it, record the corresponding row as map[i, NA].

var

Length-n.nodes list where n.nodes is the number of nodes in DAG and for which the lth element contains the indices of variables embedded in the lth node.

w

Length-n.nodes vector of positive values for which w_l gives the weight for g_l, where n.nodes is the number of nodes in DAG. If this is NULL, w_l = sqrt(|g_l|) will be used. Necessary condition is w_l increases with |g_l|.

Value

Returns assign, a matrix of p columns that gives the assignments of variables over selected path graphs, and w.assign, a list of the same length as the number of rows in assign.

assign

Each row of assign corresponds to a path graph decomposed from DAG.

w.assign

The lth element of the list contains the weights corresponding to the lth row of assign (the lth path graph).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# The following example appears in Figure 7 of Yan & Bien (2015).
# Generate map defining DAG.
map <- matrix(0, ncol=2, nrow=8)
map[1, ] <- c(1, 2)
map[2, ] <- c(2, 7)
map[3, ] <- c(3, 4)
map[4, ] <- c(4, 6)
map[5, ] <- c(6, 7)
map[6, ] <- c(6, 8)
map[7, ] <- c(3, 5)
map[8, ] <- c(5, 6)
# Assume two parameters per node.
var <- as.list(data.frame(t(matrix(1:16, ncol=2, byrow=TRUE))))
paths.result <- paths(map, var)
paths.result$assign
paths.result$w.assign

hsm documentation built on May 2, 2019, 7:24 a.m.