Skip to content
Permalink
Browse files

fixes for CRAN

  • Loading branch information...
gi0na committed Feb 2, 2019
1 parent 2f3107d commit 4a8f5e6f0a07796dc2c2c1dfdf79c37d24f24ddc
Showing with 41 additions and 37 deletions.
  1. +3 −0 .Rbuildignore
  2. +9 −12 DESCRIPTION
  3. +3 −4 R/auxilliary.R
  4. +1 −1 R/computexi.R
  5. +1 −1 R/logl.R
  6. +2 −2 R/matrixoperations.R
  7. +1 −1 README.md
  8. +6 −0 cran-comments.md
  9. +1 −1 man/ComputeXi.Rd
  10. +1 −1 man/adj_karate.Rd
  11. +1 −1 man/logl.ghype.Rd
  12. +2 −2 man/mat2vec.ix.Rd
  13. +2 −2 man/vec2mat.Rd
  14. +2 −3 man/vertexlabels.Rd
  15. +6 −6 vignettes/Significantlinks.Rmd
@@ -2,3 +2,6 @@
^\.Rproj\.user$
^.*\.Rhistory$
^.*\.gitignore$
cran-comments.md
vignettes/.gitignore
vignettes/.Rhistory
@@ -1,8 +1,8 @@
Package: ghypernet
Type: Package
Title: R Implementation of the Generalised Hypergeometric Ensemble of Random Graphs
Version: 0.5
Date: as.POSIXlt(2019-02-01)
Version: 0.5.0
Date: 2019-02-01
Authors@R: c(
person("Giona", "Casiraghi", email = "giona@ethz.ch",
role = c("aut", "cre"), comment = c(ORCID = "0000-0003-0233-5747")),
@@ -13,17 +13,13 @@ URL: http://ghyper.net
Description: R implementation of the Generalised Hypergeometric Ensemble of Random Graphs.
It provides functions for model fitting and selection of gHypEGs.
To learn how to use it, check the vignettes for a quick tutorial.
Please reference its use as DOI: 10.5281/zenodo.2555300
Please reference its use as DOI: 10.5281/zenodo.2555300 together with the references
listed below.
The package is based on the research developed at the Chair of Systems Design, ETH Zurich.
1. Casiraghi, G., Nanumyan, V., Scholtes, I., Schweitzer, F. Generalized Hypergeometric
Ensembles:
Statistical Hypothesis Testing in Complex Networks. arXiv1607.02441 (2016).
2. Casiraghi, G., Nanumyan, V., Scholtes, I., Schweitzer, F. in 111-120 (Springer Verlag,
(2017). doi:10.1007/978-3-319-67256-4_11
3. Casiraghi, G., Nanumyan, V. Generalised hypergeometric ensembles of random graphs:
the configuration model as an urn problem. (2018). arXiv1810.06495
4. Casiraghi, G. Analytical Formulation of the Block-Constrained Configuration Model.
(2018). arXiv1811.05337
Casiraghi, G., Nanumyan, V., Scholtes, I., Schweitzer, F. (2016) (http://arxiv.org/abs/1607.02441)
Casiraghi, G., Nanumyan, V., Scholtes, I., Schweitzer, F. (2017) (https://link.springer.com/chapter/10.1007/978-3-319-67256-4_11).
Casiraghi, G., Nanumyan, V. (2018) (http://arxiv.org/abs/1810.06495).
Casiraghi, G. (2018) (http://arxiv.org/abs/1811.05337).
Depends: R (>= 3.0)
License: AGPL-3 | file LICENSE
Imports: parallel,
@@ -35,3 +31,4 @@ Suggests: BiasedUrn, igraph, knitr, rmarkdown
VignetteBuilder: knitr
Encoding: UTF-8
RoxygenNote: 6.1.0
Language: en-GB
@@ -79,7 +79,7 @@ check_specs.matrix <- function(object, ...){

#' Zachary's Karate Club graph
#'
#' The weighted adjacency reparting interactions among
#' The weighted adjacency reporting interactions among
#' 34 nodes.
#'
#' @format a 34x34 matrix
@@ -88,9 +88,8 @@ check_specs.matrix <- function(object, ...){

#' Zachary's Karate Club vertex faction assignment
#'
#' The weighted adjacency reparting interactions among
#' 34 nodes.
#' The assignment of nodes to communities.
#'
#' @format a 34 vector with the assignment of nodes to faction 1 or 2
#' @format a 34-vector with the assignment of nodes to faction 1 or 2
#' @source package `igraphdata`
"vertexlabels"
@@ -1,4 +1,4 @@
#' Auxilliary function. Computes combinatorial matrix.
#' Auxiliary function. Computes combinatorial matrix.
#'
#' Combinatorial matrix computed according to soft
#' configuration model or 'regular' gnp model.
@@ -35,7 +35,7 @@ logl <- function(object, ...){
#' @param adj an optional adjacency matrix for which to compute the loglikelihood
#' @param multinomial optional boolean. Force multinomial approximation?
#' If not chosen, multinomial chosen for large graphs.
#' @param ... extra parametes
#' @param ... extra parameters
#'
#' @return
#' loglikelihood value
@@ -1,4 +1,4 @@
#' Auxilliary function, gives mask for matrix for directed,
#' Auxiliary function, gives mask for matrix for directed,
#' undirected etc.
#'
#' @param mat matrix
@@ -28,7 +28,7 @@ mat2vec.ix <- function(mat, directed,
}


#' Auxilliary function, produces matrix from vector
#' Auxiliary function, produces matrix from vector
#'
#'
#' @param vec vector to be put in matrix form
@@ -18,7 +18,7 @@ Although this is not required, it is recommended to install the `BiasedUrn` R pa
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.

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

# Contributors
@@ -0,0 +1,6 @@
## Test environments
* local OS X install, R 3.5.2
* win-builder (devel and release)

## R CMD check results
There were no ERRORs, WARNINGs or NOTEs.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -1,10 +1,10 @@
---
title: "Finding Significant Links with Hypernets"
title: "Finding Significant Links with gHypEGs"
author: "Giona CasiraghI"
date: "20/4/2018"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Finding Significant Links with Hypernets}
%\VignetteIndexEntry{Finding Significant Links with gHypEGs}
%\VignetteEngine{knitr::rmarkdown}
\usepackage[utf8]{inputenc}
---
@@ -13,7 +13,7 @@ vignette: >
knitr::opts_chunk$set(echo = TRUE)
```

In this example we use the hypernets package to detect significant links.
In this short tutorial we exploit the ghypernet package to detect significant links.
We use the Karate Club as running example.

### Load Packages
@@ -39,7 +39,7 @@ blockModel <- bccm(adj = adj_karate, labels = vertexlabels, directed = F, selflo
```

## Finding the significance of the links
We use the built-in function in the hypernets package to compute the significance of each link as described in Casiraghi et al. 2017.
We use the built-in function in the ghypernet package to compute the significance of each link as described in Casiraghi et al. 2017.
The function takes the adjacency matrix of the network and the model from which estimating the probability to observe as many edges as those in the graph.
We can obtain a high-pass noise filtering choosing a significance level and filtering those links which have a low significance.

@@ -56,7 +56,7 @@ diag(adjfiltered) <- 0

### Plot the results

We plot the original graph first, then a graph were the non-significant links are colored red.
We plot the original graph first, then a graph were the non-significant links are coloured red.
The final plot only shows the significant links.

Note that the configuration model is not able to predict the strong links within the groups, as those go beyond simple degree effects.
@@ -83,7 +83,7 @@ plot(gfiltered)
As the Karate Club consists of two factions, we can refine the model adding the block structure to it.
Then we can filter out the links that are not significant according to this more complex model.

What we expect in this case is that most of the whithin-group links are now not significant anymore, as they can be explained by the joint effect of configuration model and block model.
What we expect in this case is that most of the within-group links are now not significant anymore, as they can be explained by the joint effect of configuration model and block model.
Hence the links that remains after filtering are those that go beyond this joint effect.
In particular, only few nodes of a group interact with the other group, i.e. the between-groups links are concentrated between few dyads.
From the model instead we should expect most nodes of a group weakly interacting with the other group.

0 comments on commit 4a8f5e6

Please sign in to comment.
You can’t perform that action at this time.