plot.eigcv {gdim}R Documentation

Plot cross-validated eigenvalues

Description

Plot cross-validated eigenvalues

Usage

## S3 method for class 'eigcv'
plot(x, type = c("z-score", "adjacency", "laplacian"), threshold = 2, ...)

Arguments

x

An eigcv object created by a call to eigcv().

type

Specifies what to plot. Must be one of the following options:

  • "z-score", in which case the Z-statistic test scores are plotted for each value of k (i.e. dimension of the eigenspace).

  • "adjacency" in which case the cross-validated eigenvalues of the adjacency matrix are plotted for each value of k.

  • "laplacian" in which case the cross-validated eigenvalues of the graph Laplacian matrix are plotted for each value of k.

threshold

Only used when type == "z-score". Adds a horizontal line at the value of threshold, which should be a numeric of length one. Defaults to 2.

...

Ignored.

Value

A ggplot2 object.

Examples


library(fastRG)

set.seed(27)

B <- matrix(0.1, 5, 5)
diag(B) <- 0.3

model <- sbm(
  n = 1000,
  k = 5,
  B = B,
  expected_degree = 40,
  poisson_edges = FALSE,
  allow_self_loops = FALSE
)

A <- sample_sparse(model)

eigs<- eigcv(A, k_max = 10)
eigs

plot(eigs, type = "z-score")    # default
plot(eigs, type = "adjacency")
plot(eigs, type = "laplacian")



[Package gdim version 0.1.0 Index]