Free Access Week - Data Engineering + BI
Data Engineering and BI courses are free this week!
Free Access Week - Jun 2-8

Introduction

ghypernet is an OpenSource R package that allows to estimate and work with Generalised Hypergeometric Ensembles of Random Graphs (gHypEG).

ghypernet has been developed specifically for the analysis of networks characterised by a large number of repeated edges. It provides efficient methods to perform hypothesis testing and model selection on such data.

Explore the provided Vignettes for some examples on how to analyse networks with ghypernet.

Installation

# Install ghypernet from CRAN
install.packages("ghypernet")

# Or the development version from GitHub:
devtools::install_github("gi0na/r-ghypernet")

Dependencies

The package uses the library BiasedUrn to work with Wallenius' non-central hypergeometric distribution. Although this is not required, it is recommended to install the BiasedUrn R package, increasing the number of 'colours', i.e., the number of dimensions of the distribution. It can be easily done modifying the makevar file. In case the BiasedUrn library cannot be found, all computations will be performed using the multinomial approximation.

References

The theoretical foundation of the generalised hypergeometric ensemble, gHypEGs, has been developed in the following works:

Casiraghi, G., Nanumyan, V., Scholtes, I., & Schweitzer, F. (2016). Generalized Hypergeometric Ensembles: Statistical Hypothesis Testing in Complex Networks. ArXiv Preprint ArXiv:1607.02441.

Casiraghi, G. (2017). Multiplex Network Regression: How do relations drive interactions?. ArXiv Preprint ArXiv:1702.02048, 15.

Casiraghi, G., Nanumyan, V., Scholtes, I., & Schweitzer, F. (2017). From Relational Data to Graphs: Inferring Significant Links Using Generalized Hypergeometric Ensembles (Vol. 10540, pp. 111–120). Springer Verlag.

Casiraghi, G. (2019). The block-constrained configuration model. Applied Network Science, 4(1), 123.

Brandenberger, L., Casiraghi, G., Nanumyan, V., & Schweitzer, F. (2019). Quantifying triadic closure in multi-edge social networks. Proceedings of the 2019 IEEE/ACM International Conference on Advances in Social Networks Analysis and Mining, 307–310.

Casiraghi, G., & Nanumyan, V. (2021). Configuration models as an urn problem. Sci Rep 11, 13416.

Casiraghi, G. (2021) The likelihood-ratio test for multi-edge network models. J. Phys. Complex. 2 035012.

Acknowledgements

The research and development behind ghypernet is performed at the Chair of Systems Design, ETH Zürich.

Contributors

Giona Casiraghi (project lead)

Vahan Nanumyan

Laurence Brandenberger

Copyright

ghypernet is licensed under the GNU Affero General Public License.

(c) Copyright ETH Zürich, 2016-2021

Copy Link

Version

Install

install.packages('ghypernet')

Monthly Downloads

176

Version

1.1.0

License

AGPL-3

Maintainer

Giona Casiraghi

Last Published

October 15th, 2021

Functions in ghypernet (1.1.0)

bccm

Fitting bccm models
RMSE

Computes the Root Mean Squared Error
CreateIgGraphs

Convert a list of adjacency matrices to a list of igraph graphs.
adj_karate

Zachary's Karate Club graph
adj2el

Maps adjacency matrix to edgelist
BootstrapProperty

BootstrapProperty computes igraph analytics function on ensemble
FitOmega

Fit propensity matrix for full model
RMSLE

Computes the Root Mean Squared Logged Error
as.ghype

Map list to ghype object
coxsnellR2

Computes Cox and Snell pseudo R-squared for nrm models.
JnBlock

Fisher Information matrix for estimators in block models.
nrmChoose

Selects the best set of predictors among the given sets by means of AIC.
homophily_stat

Calculate homophily in multi-edge graphs.
coef.nrm

Extraction method for coefficients of models of class 'nrm'.
isNetwork

Test null model vs full ghype.
nr.significance

Computes the significance of more complex model against a simpler model by means of a likelihood ratio test.
checkGraphtype

Check graph input type (for whether it's a graph or a edgelist).
nrmSelection

Perform AIC forward selection for nrm.
nrm

Fitting gHypEG regression models for multi-edge networks.
lr.test

Perform likelihood ratio test between two ghype models.
create_predictors.list

Create a nrmpredictor object from list
compute_xi

Auxiliary function. Computes combinatorial matrix.
cospons_mat

Swiss MPs network adjacency matrix
get_zero_dummy

Create a dummy variable to encode zero values of another variable.
predict.nrm

Method to predict the expected values of a nrm model
mcfaddenR2

Computes Mc Fadden pseudo R-squared.
extract.nrm.cluster

Extract details from statistical models for table construction. The function has methods for a range of statistical models.
nr.ci

Confidence intervals for nrm models.
contacts.adj

Highschool contact network adjacency matrix
highschool.multiplex

Highschool contact network multiplex representation
dt

Swiss MPs attribute data frame.
conf.test

Test regular (gnp) vs configuration model
mat2vec.ix

Auxiliary function, gives mask for matrix for directed, undirected etc.
onlinesim_mat

Swiss MPs committee similarity matrix.
dtcommittee

Swiss MPs committee affiliation data frame.
rghype

Generate random realisations from ghype model.
loglratio

Compute log-likelihood ratio for ghype models.
el2adj

Maps edgelist to adjacency matrix
residuals.nrm

Method to compute residuals of nrm models
logl

General method to compute log-likelihood for ghype models.
regularm

Fit the gnm model
reciprocity_stat

Calculate weighted reciprocity change statistics for multi-edge graphs.
highschool.predictors

Highschool contact network predictors
create_predictors

Create a nrmpredictor object from passed argument
summary.nrm

Summary method for elements of class 'nrm'.
gof.test

Perform a goodness-of-fit test
linkSignificance

Estimate statistical deviations from ghype model
ghype

Fitting gHypEG models
summary.nrm_selection

Summary method for elements of class 'nrm_selection'.
logLik.ghype

Extract Log-Likelihood
sharedPartner_stat

Calculate (un-)weighted shared partner change statistics for multi-edge graphs.
vertexlabels

Zachary's Karate Club vertex faction assignment
scm

Fit the Soft-Configuration Model
vec2mat

Auxiliary function, produces matrix from vector