| as_networks | R Documentation |
as_networks() is the psychometric-network counterpart of
as_tna. It promotes the cluster-level (macro) and
within-cluster networks produced by build_mcml_pc into a
single netobject_group, so the result flows into the same
downstream verbs as any other group of networks (print(),
summary(), plot(), net_centrality).
as_networks(x)
## S3 method for class 'mcml_pc'
as_networks(x)
## Default S3 method:
as_networks(x)
x |
An object to convert. The |
Where as_tna() promotes transition networks (directed,
row-normalised, with initial probabilities) and re-wraps raw matrices,
as_networks() promotes psychometric networks (undirected;
correlation / partial-correlation / glasso). The macro and within-cluster
components of an mcml_pc object are already full netobjects carrying
their estimator, directedness and data, so this function assembles them
into a group rather than re-wrapping matrices.
A netobject_group: a named list whose first element is
macro (the cluster-level network), followed by one netobject per
non-singleton cluster.
The mcml_pc method returns a netobject_group;
singleton clusters (no within-network) are dropped with a
warning().
The default method returns the input unchanged if it is already a
netobject_group, otherwise it errors.
build_mcml_pc to create the input,
as_tna for the transition-network counterpart.
set.seed(1)
df <- as.data.frame(matrix(stats::rnorm(200 * 6), 200, 6))
names(df) <- c("a1", "a2", "a3", "b1", "b2", "b3")
clusters <- list(A = c("a1", "a2", "a3"), B = c("b1", "b2", "b3"))
fit <- build_mcml_pc(df, clusters, aggregation = "composite", method = "cor")
nets <- as_networks(fit)
nets
nets$macro$weights
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.