merge2nodes: Merge two nodes

Description Usage Arguments Value Author(s) References Examples

View source: R/APFAfunctions.R

Description

Calculates various quantities in connection with merging two nodes in a level of a sample tree.

Usage

1
merge2nodes(NS, mnode, test = TRUE, get.map = FALSE, doMerge = FALSE)

Arguments

NS

NS is a node by symbol array, the 1st half of the columns are node ids, the 2nd half the edge counts. When the corresponding edge is absent, the edge id is set to 0.

mnode

mnode is a vector of nodes to be merged, specified as vertex ids (rather than names). Required to be of length two.

test

If test=TRUE, the deviance and df associated with the merging are returned.

get.map

If get.map=TRUE, a map is returned.

doMerge

If doMerge=TRUE, NS returned is the node by symbol array after merging (used in MergeNodes)

Value

A list of computed quantities

mmat

An integer matrix containing the nodes to be merged (the original and the induced).

map

A integer vector of length vcount(G)) containing the vertex ids of the vertices after merging

devtest

A numeric vector of length two containg the degrees of freedom and deviance associated with the merging

NS

A node by symbol array representing the result of the merging

Author(s)

Smitha Ankinakatte and David Edwards

References

Ankinakatte, S. and Edwards, D. (2014?) Modelling discrete longitudinal data using acyclic probabilistic finite automata. Submitted to C.S.D.A.

Examples

1
2
3
4
5
6
library(gRapfa)
data(Wheeze)
G <- st(Wheeze)
G.c <- contract.last.level(G)
NS <- apfa2NS(G.c)
n2n <- merge2nodes(NS, c(5,3))

gRapfa documentation built on May 2, 2019, 6:54 a.m.