Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
9ce926a
adding the project repo link
aoliveram May 28, 2025
0c0a532
updating gitignore
aoliveram May 30, 2025
5cc9e5e
updating README, with link to past versions
aoliveram May 30, 2025
ebc056a
updating index, with link to past versions
aoliveram May 30, 2025
971a1ed
updating shorter version of 2-read
aoliveram May 30, 2025
7fcf3c7
shorter version of 3-netdiffuser, focusing in visualization
aoliveram May 30, 2025
8a1ba85
visualization script
aoliveram May 30, 2025
424b25f
shorter version of 4-stats
aoliveram May 30, 2025
a4531d0
updated version of 5-sim
aoliveram May 30, 2025
32a4ca8
second part of simulation, regarding multi and dis
aoliveram May 30, 2025
0053978
all up to date
aoliveram May 30, 2025
278397f
updating _quarto-yml
aoliveram May 30, 2025
0e8efc9
fixing [Visualization](3-visualization.qmd)
aoliveram May 30, 2025
3cbf203
adding title
aoliveram May 30, 2025
02a9a5f
intro files
aoliveram May 30, 2025
b5553ff
changing dates
aoliveram May 30, 2025
286de04
adjusting Appendix
aoliveram May 30, 2025
6130c03
checking for consistency
aoliveram May 30, 2025
a9b205a
adding setting chunk
aoliveram May 30, 2025
47885e6
adding getstarted as misc
aoliveram May 30, 2025
1dd7bf1
reading kfamily dataset
aoliveram Jun 4, 2025
5696399
minor changes to visualization
aoliveram Jun 4, 2025
fbf3090
adding intro to netdiffuseR as misc
aoliveram Jun 4, 2025
90f9239
minor changes to read
aoliveram Jun 4, 2025
0d71cf7
moving -Network Threshold- equation to sims
aoliveram Jun 4, 2025
68dfd83
minor changes for consistency
aoliveram Jun 4, 2025
d0b83e4
adding netdiffuser intro to misc
aoliveram Jun 4, 2025
0d5203f
adding classic diffnet analysis to read.qmd
aoliveram Jun 4, 2025
4bd7bac
adapting visualization methods to kfamily and removing contents.qmd
aoliveram Jun 4, 2025
d1c0df1
adapting to kfamily and clarifying disadoption examples
aoliveram Jun 4, 2025
c54ff55
enhancing random_dis function
aoliveram Jun 4, 2025
e86a11b
everithing up to date
aoliveram Jun 4, 2025
5b384a1
Reorganizing workshop
gvegayon Jun 4, 2025
bb6a44c
changing authors structure
aoliveram Jun 10, 2025
2c140d3
adding text and more examples to the Appendix
aoliveram Jun 10, 2025
9a4c55e
changing to village#2
aoliveram Jun 10, 2025
fae0eb4
adapting stats to kfamily
aoliveram Jun 10, 2025
ce4a32e
back to village 21
aoliveram Jun 10, 2025
79c9cfa
back to village 21
aoliveram Jun 10, 2025
8bd92de
diffreg analysis with kfam data
aoliveram Jun 10, 2025
273d6af
polishing stats lecture
aoliveram Jun 10, 2025
e7979de
polishing stats lecture 2
aoliveram Jun 10, 2025
df3d2f2
modifiying solution scripts
aoliveram Jun 10, 2025
857ba2b
adding sim-solutions
aoliveram Jun 10, 2025
f8d72ab
minor changes
aoliveram Jun 10, 2025
a3c46c2
fixing reference to sim-solutions-1
aoliveram Jun 11, 2025
a426555
changing names for consistency
aoliveram Jun 11, 2025
f10adf6
updating solution script
aoliveram Jun 11, 2025
09ffaa0
refining exercises
aoliveram Jun 11, 2025
a1b8ad5
Adding dev container
gvegayon Jun 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .devcontainer/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"r.plot.useHttpgd": true,
"r.alwaysUseActiveTerminal": true
}
19 changes: 19 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM rocker/tidyverse:4.4.0

# RUN \
# echo 'options(repos=c(CRAN="https://packagemanager.posit.co/cran/__linux__/bookworm/latest"))' >> ~/.Rprofile && \
# Rscript --vanilla -e 'getOption("repos")'

# Adding R packages
RUN install2.r Rcpp sna network networkDynamic Matrix MASS MatchIt SparseM igraph \
viridisLite covr testthat knitr rmarkdown ape RSiena survival RcppArmadillo

RUN install2.r languageserver httpgd

RUN apt-get update && apt-get install --no-install-recommends -y valgrind gdb \
libglpk-dev

RUN Rscript --vanilla -e \
'remotes::install_github("USCCANA/netdiffuseR@gvegayon-preparing-release-connections")'

CMD ["bash"]
36 changes: 36 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
"name": "epiworldR",
"build": {
"dockerfile": "Dockerfile"
},
"customizations": {
"vscode": {
"extensions": [
"reditorsupport.r",
"rdebugger.r-debugger",
"quarto.quarto",
"tianyishi.rmarkdown"
]
}
},
"mounts": [
// Mount the .vscode configuration into the container
"source=${localWorkspaceFolder}/.devcontainer/.vscode,target=/workspaces/${localWorkspaceFolderBasename}/.vscode,type=bind,consistency=cached"
]
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "gcc -v",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
*_cache/
*_files/
.Rproj.user
.Rhistory
.DS_Store
*/.DS_Store
**/.DS_Store

/.quarto/
docs/
Expand Down
File renamed without changes.
66 changes: 66 additions & 0 deletions 0-netdiffuser.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
title: "Introduction to the package"
author: "George G. Vega Yon and Aníbal Olivera M."
date: "2025-06-24"
date-modified: "2025-06-24"
---

```{r setup, echo=FALSE, message=FALSE, warning=FALSE}
library(netdiffuseR)
knitr::opts_chunk$set(comment = "#")
```


- **Network thresholds** (Valente, 1995; 1996), $\tau$, are defined as the required proportion or number of neighbors that leads you to adopt a particular behavior (innovation), $a=1$. In (very) general terms\pause

$$
a_i = \left\{\begin{array}{ll}
1 &\mbox{if } \tau_i\leq E_i \\
0 & \mbox{Otherwise}
\end{array}\right. \qquad
E_i \equiv \frac{\sum_{j\neq i}\mathbf{X}_{ij}a_j}{\sum_{j\neq i}\mathbf{X}_{ij}}
$$

Where $E_i$ is i's exposure to the innovation and $\mathbf{X}$ is the adjacency matrix (the network).

- This can be generalized and extended to include covariates and other network weighting schemes (that's what __netdiffuseR__ is all about).

# netdiffuseR

- **netdiffuseR** is an R package that:

- Allow to generalize the network threshold concept to include covariates and other network weighting schemes.

- Is designed for Visualizing, Analyzing and Simulating network diffusion data (in general).

- Depends on some pretty popular packages:

- _RcppArmadillo_: So it's fast,
- _Matrix_: So it's big,
- _statnet_ and _igraph_: So it's not from scratch

- Can handle big graphs, e.g., an adjacency matrix with more than 4 billion elements (PR for RcppArmadillo).

- Already on CRAN with +48,000 downloads since its first version, Feb 2016.

<!-- Can simulate Threshold Diffusion Models (also know as Complex Contagion) in different scenarios, including multiple simulations at once, multi-diffusion settings, and disadoption parameters. -->

- **Datasets**

- **netdiffuseR** has the three classic Diffusion Network Datasets, both as surveys:

- `medInnovations` Doctors and the innovation of Tetracycline (1955),
- `brfarmers` Brazilian farmers and the innovation of Hybrid Corn Seed (1966),
- `kfamily` Korean women and Family Planning methods (1973),

and as `diffnet` objects:

- `medInnovationsDiffNet` Doctors and the innovation of Tetracycline (1955),
- `brfarmersDiffNet` Brazilian farmers and the innovation of Hybrid Corn Seed (1966),
- `kfamilyDiffNet` Korean women and Family Planning methods (1973)

```{r printing}
brfarmersDiffNet
medInnovationsDiffNet
kfamilyDiffNet
```
Loading