| as_tna | R Documentation |
Converts a cluster_summary object to proper tna objects that can be
used with all functions from the tna package. Creates both a between-cluster
tna model (cluster-level transitions) and within-cluster tna models (internal
transitions within each cluster).
as_tna(x)
## S3 method for class 'mcml'
as_tna(x)
## Default S3 method:
as_tna(x)
x |
A |
This is the final step in the MCML workflow, enabling full integration with the tna package for centrality analysis, bootstrap validation, permutation tests, and visualization.
The tna package must be installed. If not available, the function throws an error with installation instructions.
# Full MCML workflow net <- build_network(data, method = "relative") net$nodes$clusters <- group_assignments cs <- cluster_summary(net, type = "tna") tna_models <- as_tna(cs) # Now use tna package functions plot(tna_models$macro) tna::centralities(tna_models$macro) tna::bootstrap(tna_models$macro, iter = 1000) # Analyze within-cluster patterns plot(tna_models$clusters$ClusterA) tna::centralities(tna_models$clusters$ClusterA)
A within-cluster tna cannot be created when:
The cluster has only 1 node (no internal transitions possible)
Some nodes in the cluster have no outgoing edges (row sums to 0)
These clusters are silently excluded from $clusters. The between-cluster
model still includes all clusters.
A cluster_tna object (S3 class) containing:
A tna object representing cluster-level transitions.
Contains $weights (k x k transition matrix), $inits
(initial distribution), and $labels (cluster names).
Use this for analyzing how learners/entities move between high-level
groups or phases.
Named list of tna objects, one per cluster. Each tna object
represents internal transitions within that cluster. Contains
$weights (n_i x n_i matrix), $inits (initial distribution),
and $labels (node labels). Clusters with single nodes or zero-row
nodes are excluded (tna requires positive row sums).
A netobject_group with data preserved from each sub-network.
A tna object constructed from the input.
cluster_summary to create the input object,
plot() for visualization without conversion,
tna::tna for the underlying tna constructor
mat <- matrix(runif(36), 6, 6)
rownames(mat) <- colnames(mat) <- LETTERS[1:6]
clusters <- list(G1 = c("A", "B"), G2 = c("C", "D"), G3 = c("E", "F"))
cs <- cluster_summary(mat, clusters, type = "tna")
tna_models <- as_tna(cs)
tna_models
tna_models$macro$weights
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.