Description Usage Arguments Value Note Examples
Visualize the conditional (in)dependence structure.
1 2 3 4 5 6 7 8 9 10 11 12 |
x |
An object of class |
layout |
Character string. Which graph layout (defaults is |
pos_col |
Character string. Color for the positive edges (defaults to |
neg_col |
Character string. Color for the negative edges (defaults to |
node_size |
Numeric. The size of the nodes (defaults to |
edge_magnify |
Numeric. A value that is multiplied by the edge weights. This increases (> 1) or decrease (< 1) the line widths (defaults to 1). |
groups |
A character string of length p (the number of nodes in the model). This indicates groups of nodes that should be the same color (e.g., "clusters" or "communities"). |
palette |
A character string sepcifying the palette for the |
... |
Additional options passed to ggnet2 |
An object (or list of objects) of class ggplot
that can then be further customized.
A more extensive example of a custom plot is provided here
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | #########################
### example 1: one ggm ##
#########################
# data
Y <- bfi[,1:25]
# estimate
fit <- estimate(Y, iter = 250,
progress = FALSE)
# "communities"
comm <- substring(colnames(Y), 1, 1)
# edge set
E <- select(fit)
# plot edge set
plt_E <- plot(E, edge_magnify = 5,
palette = "Set1",
groups = comm)
#############################
### example 2: ggm compare ##
#############################
# compare males vs. females
# data
Y <- bfi[,1:26]
Ym <- subset(Y, gender == 1,
select = -gender)
Yf <- subset(Y, gender == 2,
select = -gender)
# estimate
fit <- ggm_compare_estimate(Ym, Yf, iter = 250,
progress = FALSE)
# "communities"
comm <- substring(colnames(Ym), 1, 1)
# edge set
E <- select(fit)
# plot edge set
plt_E <- plot(E, edge_magnify = 5,
palette = "Set1",
groups = comm)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.