Package: nevada 0.2.0

Aymeric Stamm

nevada: Network-Valued Data Analysis

A flexible statistical framework for network-valued data analysis. It leverages the complexity of the space of distributions on graphs by using the permutation framework for inference as implemented in the 'flipr' package. Currently, only the two-sample testing problem is covered and generalization to k samples and regression will be added in the future as well. It is a 4-step procedure where the user chooses a suitable representation of the networks, a suitable metric to embed the representation into a metric space, one or more test statistics to target specific aspects of the distributions to be compared and a formula to compute the permutation p-value. Two types of inference are provided: a global test answering whether there is a difference between the distributions that generated the two samples and a local test for localizing differences on the network structure. The latter is assumed to be shared by all networks of both samples. References: Lovato, I., Pini, A., Stamm, A., Vantini, S. (2020) "Model-free two-sample test for network-valued data" <doi:10.1016/j.csda.2019.106896>; Lovato, I., Pini, A., Stamm, A., Taquet, M., Vantini, S. (2021) "Multiscale null hypothesis testing for network-valued data: Analysis of brain networks of patients with autism" <doi:10.1111/rssc.12463>.

Authors:Ilenia Lovato [aut], Alessia Pini [aut], Aymeric Stamm [aut, cre], Simone Vantini [aut]

nevada_0.2.0.tar.gz
nevada_0.2.0.tar.gz(r-4.5-noble)nevada_0.2.0.tar.gz(r-4.4-noble)
nevada_0.2.0.tgz(r-4.4-emscripten)nevada_0.2.0.tgz(r-4.3-emscripten)
nevada.pdf |nevada.html
nevada/json (API)
NEWS

# Install 'nevada' in R:
install.packages('nevada', repos = 'https://cloud.r-project.org')

Bug tracker:https://github.com/astamm/nevada/issues

Uses libs:
  • openblas– Optimized BLAS
  • c++– GNU Standard C++ Library v3

On CRAN:

Conda:

openblascpp

2.70 score 149 downloads 1 mentions 35 exports 89 dependencies

Last updated 2 years agofrom:308e2ee20e. Checks:2 OK, 1 NOTE. Indexed: no.

TargetResultLatest binary
Doc / VignettesOKMar 28 2025
R-4.5-linux-x86_64NOTEMar 28 2025
R-4.4-linux-x86_64OKMar 28 2025

Exports:%>%as_nvdas_vertex_partitiondist_frobeniusdist_hammingdist_nvddist_root_euclideandist_spectraledge_count_global_variablesgenerate_sigma_algebraipro_frobeniusnvdpower2rbinom_networkrepr_adjacencyrepr_graphonrepr_laplacianrepr_modularityrepr_nvdrexp_networkrpois_networkrsbmsample2_sbmstat_generalized_edge_countstat_original_edge_countstat_student_euclideanstat_weighted_edge_countstat_welch_euclideansubgraph_fullsubgraph_intersubgraph_intratest2_globaltest2_localvar_nvdvar2_nvd

Dependencies:askpassclicliprcodetoolscolorspacecpp11crayoncredentialscurldescdialsDiceDesigndigestdplyrfansifarverfliprforcatsfsfurrrfuturegenericsgertggplot2ghgitcredsglobalsgluegtablehardhatherehttr2igraphiniisobandjsonlitelabelinglatticelifecyclelistenvmagrittrMASSMatrixmgcvmunsellnlmeopenssloptimParallelparallellypbapplypillarpkgconfigpngpurrrR6rappdirsrbibutilsRColorBrewerRcppRcppArmadilloRcppEigenRcppTOMLRdpackreticulatergenoudrgeomstatsrlangrprojrootRSpectrarstudioapiscalessfdsparsevctrsstringistringrsystibbletidyrtidyselecttsneumapusethisutf8vctrsviridisLitewhiskerwithryamlzip

Network-Valued Data Analysis

Rendered fromnevada.Rmdusingknitr::rmarkdownon Mar 28 2025.

Last update: 2023-09-03
Started: 2021-09-25

Citation

To cite package ‘nevada’ in publications use:

Lovato I, Pini A, Stamm A, Vantini S (2023). nevada: Network-Valued Data Analysis. R package version 0.2.0, https://CRAN.R-project.org/package=nevada.

Corresponding BibTeX entry:

  @Manual{,
    title = {nevada: Network-Valued Data Analysis},
    author = {Ilenia Lovato and Alessia Pini and Aymeric Stamm and
      Simone Vantini},
    year = {2023},
    note = {R package version 0.2.0},
    url = {https://CRAN.R-project.org/package=nevada},
  }

Readme and manuals

Overview

The package nevada (NEtwork-VAlued Data Analysis) is an R package for the statistical analysis of network-valued data. In this setting, a sample is made of statistical units that are networks themselves. The package provides a set of matrix representations for networks so that network-valued data can be transformed into matrix-valued data. Subsequently, a number of distances between matrices is provided as well to quantify how far two networks are from each other and several test statistics are proposed for testing equality in distribution between samples of networks using exact permutation testing procedures. The permutation scheme is carried out by the flipr package which also provides a number of test statistics based on inter-point distances that play nicely with network-valued data. The implementation is largely made in C++ and the matrix of inter- and intra-sample distances is pre-computed, which alleviates the computational burden often associated with permutation tests.

Installation

You can install the latest stable version of nevada on CRAN with:

install.packages("nevada")

Or you can install the development version from GitHub with:

# install.packages("remotes")
remotes::install_github("astamm/nevada")

Usage

Example 1

In this first example, we compare two populations of networks generated according to two different models (Watts-Strogatz and Barabasi), using the adjacency matrix representation of networks, the Frobenius distance to compare single networks and the combination of Student-like and Fisher-like statistics based on inter-point distances to summarize information and perform the permutation test.

set.seed(123)
n <- 10L
x <- nevada::nvd(
  model = "smallworld", 
  n = n, 
  model_params = list(dim = 1L, nei = 4L, p = 0.15)
)
y <- nevada::nvd(
  model = "pa", 
  n = n, 
  model_params = list(power = 1L, m = NULL, directed = FALSE)
)

By default the nvd() constructor generates networks with 25 nodes. One can wonder whether there is a difference between the distributions that generated these two samples (which there is given the models that we used). The test2_global() function provides an answer to this question:

t1_global <- nevada::test2_global(x, y, seed = 1234)
t1_global$pvalue
[1] 0.0009962984

The p-value is very small, leading to the conclusion that we should reject the null hypothesis of equal distributions.

Although this is a fake example, we could create a partition to try to localize differences along this partition:

partition <- as.integer(c(1:5, each = 5))

The test2_local() function provides an answer to this question:

t1_local <- nevada::test2_local(x, y, partition, seed = 1234)
t1_local
$intra
# A tibble: 5 × 3
  E      pvalue truncated
  <chr>   <dbl> <lgl>    
1 P1    0.175   TRUE     
2 P2    0.175   TRUE     
3 P3    0.175   TRUE     
4 P4    0.0859  TRUE     
5 P5    0.00299 FALSE    

$inter
# A tibble: 10 × 4
   E1    E2      pvalue truncated
   <chr> <chr>    <dbl> <lgl>    
 1 P1    P2    0.175    TRUE     
 2 P1    P3    0.175    TRUE     
 3 P1    P4    0.0859   TRUE     
 4 P1    P5    0.0240   FALSE    
 5 P2    P3    0.175    TRUE     
 6 P2    P4    0.00499  FALSE    
 7 P2    P5    0.000996 FALSE    
 8 P3    P4    0.0140   FALSE    
 9 P3    P5    0.00200  FALSE    
10 P4    P5    0.0420   FALSE    
Example 2

In this second example, we compare two populations of networks generated according to the same model (Watts-Strogatz), using the adjacency matrix representation of networks, the Frobenius distance to compare single networks and the combination of Student-like and Fisher-like statistics based on inter-point distances to summarize information and perform the permutation test.

n <- 10L
x <- nevada::nvd("smallworld", n)
y <- nevada::nvd("smallworld", n)

One can wonder whether there is a difference between the distributions that generated these two samples (which there is given the models that we used). The test2_global() function provides an answer to this question:

t2 <- nevada::test2_global(x, y, seed = 1234)
t2$pvalue
[1] 0.9999973

The p-value is larger than 5% or even 10%, leading us to failing to reject the null hypothesis of equal distributions at these significance thresholds.

Help Manual

Help pageTopics
Coercion to Network-Valued Data Objectas_nvd
Coercion to Vertex Partitionas_vertex_partition
Pairwise Distance Matrix Between Two Samples of Networksdist_nvd
Distances Between Networksdistances dist_frobenius dist_hamming dist_root_euclidean dist_spectral
Transform distance matrix in edge properties of minimal spanning treeedge_count_global_variables
Sigma-Algebra generated by a Partitiongenerate_sigma_algebra
Inner-Products Between Networksinner-products ipro_frobenius
Fréchet Mean of Network-Valued Datamean.nvd
Network-Valued Data Constructornvd
MDS Visualization of Network Distributionsautoplot.nvd nvd-plot plot.nvd
Power Simulations for Permutation Testspower2
Network-Valued to Matrix-Valued Datarepr_nvd
Network Representation Functionsrepresentations repr_adjacency repr_graphon repr_laplacian repr_modularity
Two-Sample Stochastic Block Model Generatorsample2_sbm
Graph samplers using edge distributionsrbinom_network rexp_network rpois_network rsbm samplers
Test Statistics for Network Populationsstatistics stat_generalized_edge_count stat_original_edge_count stat_student_euclidean stat_weighted_edge_count stat_welch_euclidean
Full, intra and inter subgraph generatorssubgraphs subgraph_full subgraph_inter subgraph_intra
Global Two-Sample Test for Network-Valued Datatest2_global
Local Two-Sample Test for Network-Valued Datatest2_local
Fréchet Variance of Network-Valued Data Around a Given Networkvar_nvd
Fréchet Variance of Network-Valued Data from Inter-Point Distancesvar2_nvd