knitr::opts_chunk$set(
  message = FALSE,
  warning = FALSE,
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

set.seed(27)

vsp

Codecov test coverage CRAN status R-CMD-check

The goal of vsp is to enable fast, spectral estimation of latent factors in random dot product graphs. Under mild assumptions, the vsp estimator is consistent for (degree-corrected) stochastic blockmodels, (degree-corrected) mixed-membership stochastic blockmodels, and degree-corrected overlapping stochastic blockmodels.

More generally, the vsp estimator is consistent for random dot product graphs that can be written in the form

E(A) = Z B Y^T

where Z and Y satisfy the varimax assumptions of [1]. vsp works on directed and undirected graphs, and on weighted and unweighted graphs. Note that vsp is a semi-parametric estimator.

Installation

You can install the released version of vsp from CRAN with

install.packages("vsp")

You can install the development version of vsp with:

install.packages("devtools")
devtools::install_github("RoheLab/vsp")

Example

Obtaining estimates from vsp is straightforward. We recommend representing networks as igraph objects or sparse adjacency matrices using the Matrix package. Once you have your network in one of these formats, you can get estimates by calling the vsp() function. The result is a vsp_fa S3 object.

Here we demonstrate vsp usage on an igraph object, using the enron network from igraphdata package to demonstrate this functionality. First we peak at the graph:

library(igraph)
data(enron, package = "igraphdata")

image(sign(get.adjacency(enron, sparse = FALSE)))

Now we estimate:

library(vsp)

fa <- vsp(enron, rank = 30)
fa
get_varimax_z(fa)

To visualize a screeplot of the singular value, use:

screeplot(fa)

At the moment, we also enjoy using pairs plots of the factors as a diagnostic measure:

plot_varimax_z_pairs(fa, 1:5)
plot_varimax_y_pairs(fa, 1:5)

Similarly, an IPR pairs plot can be a good way to check for singular vector localization (and thus overfitting!).

plot_ipr_pairs(fa)
plot_mixing_matrix(fa)

References

[1] Rohe, Karl, and Muzhe Zeng. “Vintage Factor Analysis with Varimax Performs Statistical Inference.” Journal of the Royal Statistical Society Series B: Statistical Methodology 85, no. 4 (September 29, 2023): 1037–60. https://doi.org/10.1093/jrsssb/qkad029.

Code to reproduce the results from the paper is available here.



RoheLab/vsp documentation built on Nov. 6, 2024, 10:08 p.m.