Skip to contents

Correlation network plot.

Usage

cor_network(
  data,
  index = c("cor", "pcor"),
  show.value = TRUE,
  show.insig = FALSE,
  show.cutoff = FALSE,
  faded = FALSE,
  text.size = 1.2,
  node.group = NULL,
  node.color = NULL,
  edge.color.pos = "#0571B0",
  edge.color.neg = "#CA0020",
  edge.color.insig = "#EEEEEEEE",
  title = NULL,
  file = NULL,
  width = 6,
  height = 4,
  dpi = 500,
  ...
)

Arguments

data

Data.

index

Type of graph: "cor" (raw correlation network) or "pcor" (partial correlation network). Defaults to "cor".

show.value

Show correlation coefficients and their significance on edges. Defaults to TRUE.

show.insig

Show edges with insignificant correlations (p > 0.05). Defaults to FALSE. To change significance level, please set the alpha parameter (defaults to alpha=0.05).

show.cutoff

Show cut-off values of correlations. Defaults to FALSE.

faded

Transparency of edges according to the effect size of correlation. Defaults to FALSE.

text.size

Scalar on the font size of variable labels. Defaults to 1.2.

node.group

A list that indicates which nodes belong together, with each element of list as a vector of integers identifying the column numbers of variables that belong together.

node.color

A vector with a color for each element in node.group, or a color for each node.

edge.color.pos

Color for (significant) positive correlations. Defaults to "#0571B0" (blue in ColorBrewer's RdBu palette).

edge.color.neg

Color for (significant) negative correlations. Defaults to "#CA0020" (red in ColorBrewer's RdBu palette).

edge.color.insig

Color for insignificant correlations. Defaults to "#EEEEEEEE" (transparent grey).

title

Plot title.

file

File name of saved plot (".png" or ".pdf").

width, height

Width and height (in inches) of saved plot. Defaults to 6 and 4.

dpi

Dots per inch (figure resolution). Defaults to 500.

...

Other parameters passed to qgraph.

Value

Invisibly return a qgraph object.

Examples

cor_network(airquality)

cor_network(airquality, show.insig=TRUE)