R package which implements the St. Nicolas House Algorithm (SNHA) for constructing networks of correlated variables using a ranking of the pairwise correlation values. The package contains the R code for the papers:
For an implementation of the algorithm in Python look here https://github.com/thake93/snha4py.
library(remotes)
remotes::install_github("https://github.com/mittelmark/snha")
Thereafter you can check the installation like this:
library(snha)
citation("snha")
Which should display something like this:
> citation("snha")
To cite package 'snha' in publications use:
> citation("snha")
To cite package ‘snha’ in publications use:
Detlef Groth, University of Potsdam (2023). snha: St.
Nicolas House Algorithm for R. R package version 0.1.
...
The package has a function snha
where you give your data
as input. The function creates an object of class snha
which you can plot and explore easily. Here an example just using the
swiss
data which are part of every R installation:
> library(snha)
> library(MASS)
> data(swiss)
> colnames(swiss)=abbreviate(swiss)
> as=snha(swiss,method="spearman")
> plot(as)
> plot(as,layout="sam",vertex.size=8)
> ls(as)
1] "alpha" "chains" "data" "method"
[5] "p.values" "probabilities" "sigma" "theta"
[9] "threshold"
[> as$theta
Frtl Agrc Exmn Edct Cthl In.M0 0 1 0 0 1
Frtl 0 0 0 1 0 0
Agrc 1 0 0 1 1 0
Exmn 0 1 1 0 0 0
Edct 0 0 1 0 0 0
Cthl 1 0 0 0 0 0 In.M
The theta object contains the adjacency matrix with the edges for the
found graph. For more details consult the package vignette:
vignette(package="snha","tutorial")
or the manual package
of the package ?snha
or ?'snha-package'
.
Author: Detlef Groth, University of Potsdam, Germany
License: MIT License see the file LICENSE for details.
In case of bugs and suggestions, use the issues link on top.