-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
90 lines (70 loc) · 2.69 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# `Isinglandr`: Landscape Construction and Simulation for Ising Networks <img src='man/figures/logo.png' align="right" height="138" />
<!-- badges: start -->
[![CRAN status](https://www.r-pkg.org/badges/version/Isinglandr)](https://CRAN.R-project.org/package=Isinglandr)
![](https://img.shields.io/badge/lifecycle-experimental-orange.svg)
[![](https://cranlogs.r-pkg.org/badges/Isinglandr)](https://cran.r-project.org/package=Isinglandr)
[![R-CMD-check](https://github.com/Sciurus365/Isinglandr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/Sciurus365/Isinglandr/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->
A toolbox for constructing potential landscapes for Ising
networks. The parameters of the networks can be directly supplied by
users or estimated by the `IsingFit` package by van Borkulo and
Epskamp (2016) <https://CRAN.R-project.org/package=IsingFit> from
empirical data. The Ising model's Boltzmann distribution is preserved
for the potential landscape function. The landscape functions can be
used for quantifying and visualizing the stability of network states,
as well as visualizing the simulation process.
## Installation
You can install the development version of Isinglandr from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("Sciurus365/Isinglandr")
```
## Example
### Landscape construction
```{r example}
library(Isinglandr)
# A toy network and its landscape
Nvar <- 10
m <- rep(0, Nvar)
w <- matrix(0.1, Nvar, Nvar)
diag(w) <- 0
result1 <- make_2d_Isingland(m, w)
plot(result1)
## What if the network becomes denser?
result2 <- make_2d_Isingland(m, 1.5 * w)
plot(result2)
## What if the thresholds become lower?
result3 <- make_2d_Isingland(m - 0.5, w)
plot(result3)
## Multiple networks together
result4 <- make_Ising_grid(
all_thresholds(seq(-0.1, 0.1, 0.1), .f = `+`),
whole_weiadj(seq(0.5, 1.5, 0.5)),
m, w
) %>% make_2d_Isingland_matrix()
plot(result4)
```
### Simulation on landscapes
```{r message=FALSE, cache=TRUE}
set.seed(1614)
sim1 <- simulate_Isingland(result1, initial = 5)
plot(sim1)
set.seed(1614)
sim4 <- simulate_Isingland(result4, initial = 5)
plot(sim4)
```
## Shiny app
A shiny app is included in this package to show the landscape for the Ising network of major depressive disorder. The network parameters can be manipulated to see how they influence the landscape and the simulation.
Run `shiny_Isingland_MDD()` to start it.