| as_htna | R Documentation |
Builds the full node-level network from the original data and attaches a
cluster grouping, producing a single netobject in which every actor
is a node and cluster membership labels the actors. This is the node-level
counterpart of build_mcml: where build_mcml collapses
the network to a cluster-level (macro) summary, as_htna keeps every
node and every transition - including the between-cluster transitions an
mcml only retains in aggregate.
as_htna(x, clusters = NULL, method = "relative", ...)
## S3 method for class 'mcml'
as_htna(x, clusters = NULL, method = "relative", data = NULL, ...)
## Default S3 method:
as_htna(x, clusters = NULL, method = "relative", ...)
x |
Data accepted by |
clusters |
Cluster assignment: a named list of node-name vectors, a
per-node membership vector, or a two-column data frame. When |
method |
Estimator passed to |
... |
Further arguments forwarded to |
data |
For the |
Why this rebuilds from data. An mcml stores cluster-level
data (the macro sequences are recoded to cluster labels, and the per-cluster
data is filtered to within-cluster nodes), so it does not retain a faithful
node-level transition network. The only faithful source of node-level
between-cluster transitions is the original data. as_htna() therefore
rebuilds from data via build_network; an mcml can supply
the cluster membership, but the data must be provided.
The result is a genuine netobject, so it supports inference
(bootstrap_network, centrality, permutation)
and plots directly as a grouped network with cograph:
cograph::plot_htna(as_htna(data, clusters)).
A netobject (cograph_network) over all nodes, with a
cluster column on $nodes, $node_groups populated, and
the membership stored in the "cluster_members" attribute.
build_mcml, build_network; plot with
cograph::plot_htna().
seqs <- data.frame(
t1 = c("A", "C", "E", "B"), t2 = c("B", "D", "F", "A"),
t3 = c("C", "A", "E", "D"), stringsAsFactors = FALSE
)
clusters <- list(C1 = c("A", "B"), C2 = c("C", "D"), C3 = c("E", "F"))
net <- as_htna(seqs, clusters)
net$nodes$cluster
## Not run:
cograph::plot_htna(net)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.