goldfish

Actor-oriented and tie-based network event models in R

https://github.com/stocnet/goldfish

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (18.1%) to scientific vocabulary

Keywords

dynam network-modelling rem statistical-network-analysis
Last synced: 6 months ago · JSON representation

Repository

Actor-oriented and tie-based network event models in R

Basic Info
Statistics
  • Stars: 63
  • Watchers: 10
  • Forks: 13
  • Open Issues: 24
  • Releases: 22
Topics
dynam network-modelling rem statistical-network-analysis
Created over 6 years ago · Last pushed 7 months ago
Metadata Files
Readme Changelog Contributing Code of conduct

README.Rmd

---
output: github_document
bibliography: inst/REFERENCES.bib
---



```{r setup, include=FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
library(goldfish)
```

# goldfish   


![GitHub release (latest by date)](https://img.shields.io/github/v/release/stocnet/goldfish)
![GitHub Release Date](https://img.shields.io/github/release-date/stocnet/goldfish)
![GitHub issues](https://img.shields.io/github/issues-raw/stocnet/goldfish)
![GitHub All Releases](https://img.shields.io/github/downloads/stocnet/goldfish/total)
[![R-CMD-check](https://github.com/stocnet/goldfish/actions/workflows/R-CMD-check.yml/badge.svg)](https://github.com/stocnet/goldfish/actions/workflows/R-CMD-check.yml)
[![Codecov test coverage](https://codecov.io/gh/stocnet/goldfish/branch/main/graph/badge.svg)](https://app.codecov.io/gh/stocnet/goldfish?branch=main)
[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/4563/badge)](https://www.bestpractices.dev/projects/4563)




## Description

The `{goldfish}` package offers a collection of tools designed for applying
statistical models to dynamic network data.
It primarily focus on models for relational event data, namely,
sequences of interactions between actors or entities within a network,
enriched by fine-grained time-stamps information.
Relational event data emerge in various domains,
such as automatically collected data about interactions in
communication and social media research,
social science studies using social sensors,
and archival network studies that provide in-depth details regarding
the timing or sequence of relational actions between nodes.

Currently, the package includes the following models:

- **Dynamic Network Actor Models (DyNAM)**: Investigate relational event models
  as an actor-oriented decision process. 
  - *rate*: Actors compete for creating the next relational event [@hollway2020rate]
  - *choice*: The active actor chooses the receiver of the event from among the same [@stadtfeld2017interaction] or a different set of nodes [@hollway2022multimodal]
  - *choice_coordination*: The creation of coordination ties as a two-sided
    process [@stadtfeld2017coordination]
- **Dynamic Network Actor Models for interactions (DyNAMi)**:
  Investigate dynamics of conversation groups and interpersonal interaction in
  different social contexts from an actor-oriented perspective 
  [@hoffman2020groups]
  - *rate*: Actors compete for joining or leaving groups
  - *choice*: The active actor choose the group to join
- **Relational Event Models (REM)**: Investigate relational event models
  as a tie-oriented process [@butts2008relational], taking into account right-censoring [@stadtfeld2017rejoinder].
  
### Vignettes

For detailed documentation on each model, including usage examples, users are
encouraged to consult the package's vignettes and help files:

- [Getting Started with goldfish (DyNAM and 
  REM)](https://stocnet.github.io/goldfish/articles/teaching1.html)
- [Coordination ties (DyNAM-choice
  coordination)](https://stocnet.github.io/goldfish/articles/teaching2.html)
- [Face to face interactions 
  (DyNAMi)](https://stocnet.github.io/goldfish/articles/dynami-example.html)
- [Catalog of available 
  effects](https://stocnet.github.io/goldfish/articles/goldfishEffects.html)
  
## Table of Contents

- [Installation](#installation)
- [Usage](#usage)
    + [Define data objects and link events](#define-data-objects-and-link-events)
    + [Define dependent events](#define-dependent-events)
    + [Model specification and estimation](#model-specification-and-estimation)
- [About](#about)
- [References](#references)

## Installation

You can install `{goldfish}` directly from
[CRAN](https://cran.r-project.org/package=goldfish):

``` r load_package
install.packages("goldfish")
```

To install the development version from GitHub, use the
[remotes](https://cran.r-project.org/package=remotes) package:

- For latest stable version: 
`remotes::install_github("stocnet/goldfish", build_vignettes = TRUE)`
- For latest development version: 
`remotes::install_github("stocnet/goldfish@develop", build_vignettes = TRUE)`

Or by downloading and install the latest binary releases for all major OSes
-- Windows, Mac, and Linux -- can be found 
[here](https://github.com/stocnet/goldfish/releases).

## Usage

Below is a quick-start guide to using the `{goldfish}` package.
The dataset used in this example is an abbreviated version of the
MIT Social Evolution data (`?Social_Evolution`).

### Define data objects and link events

The main data objects required for the analysis are the node set(s) 
`make_nodes()` and network(s) `make_network()`.
The node set object contains labels and attributes of the actors in the network.
In contrast, a network object contains the information of past relational events
between actors.
By default, `make_network()` constructs an empty matrix, its dimensions
defined by the length of the nodeset(s).
Data frames containing event data that modify these data objects can be
linked to them using the `link_events()` method.

```{r load_data}
library(goldfish)
data("Social_Evolution")

callNetwork <- make_network(nodes = actors, directed = TRUE) |> # 1
  link_events(change_events = calls, nodes = actors) # 2

```

The events data frame, which indicates the time-varying attributes in
the node set, contains the following columns:

- `time`: The time when the attribute changes,
  either a `numeric` or `POSIXct` value.
- `node`: The node for which the attribute changes, a `character` value
  that matches the `label` variable in the node set.
- `replace`: The new value of the attribute, a `numeric` value.

The events data frame that details the relational events between actors
contains the following columns:

- `time`: The time when the event occurred,
  either a `numeric` or `POSIXct` value.
- `sender`: The actor initiating the event, a `character` value
  that matches the `label` variable in the node set.
- `receiver`: The actor receiving the event, a `character` value
  that matches the `label` variable in the node set.
- `increment` or `replace`: A `numeric` value indicating either the increment
  that the relational event represents or the new value.

### Define dependent events

The next step in defining the data objects is to identify the dependent events.
Here we would like to model as the dependent variable the calls
between individuals.
We specify the event data frame and the node set.

```{r dependent_events}
callsDependent <- make_dependent_events(
  events = calls, nodes = actors,
  default_network = callNetwork
  )
```

The final step is to make a goldfish object.
The data object is a goldfish object that contains all the information
needed to estimate the model.
So, it is a container for the dependent events, the networks, and the nodes
containing all the information of the dependent events and any dyadic or
nodal covariate used as explanatory variables in the model.

```{r goldfish_object}
socialEvolutionData <- make_data(
  callsDependent, callNetwork, calls, actors
)
```

### Model specification and estimation

We specify our model using the standard R formula format like:

`goldfish_dependent ~ effects(process_state_element)`

We can see which effects are currently available and how to specify them here:


```r
vignette("goldfishEffects")
```

Now to estimate this model, we use the a `?estimate` function.
For the DyNAM model the `estimate_dynam()` function is used.

```{r}
mod00Rate <- estimate_dynam(
  callsDependent ~ indeg + outdeg,
  sub_model = "rate",
  data = socialEvolutionData
)

summary(mod00Rate)

mod00Choice <- estimate_dynam(
  callsDependent ~ inertia + recip + trans,
  sub_model = "choice",
  data = socialEvolutionData
)
summary(mod00Choice)
```


## About

This project is a joint collaboration between the **Social Networks Lab at ETH Zürich** and the **Geneva Graduate Institute**,
and incorporates and supports several sub-projects.

## References

Owner

  • Name: stocnet
  • Login: stocnet
  • Kind: organization

Stochastic network software

GitHub Events

Total
  • Create event: 6
  • Release event: 3
  • Issues event: 9
  • Watch event: 3
  • Issue comment event: 14
  • Push event: 38
  • Pull request review event: 2
  • Pull request review comment event: 2
  • Pull request event: 5
  • Fork event: 1
Last Year
  • Create event: 6
  • Release event: 3
  • Issues event: 9
  • Watch event: 3
  • Issue comment event: 14
  • Push event: 38
  • Pull request review event: 2
  • Pull request review comment event: 2
  • Pull request event: 5
  • Fork event: 1

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 14
  • Total pull requests: 10
  • Average time to close issues: over 1 year
  • Average time to close pull requests: about 4 hours
  • Total issue authors: 5
  • Total pull request authors: 1
  • Average comments per issue: 0.5
  • Average comments per pull request: 0.1
  • Merged pull requests: 9
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 6
  • Pull requests: 3
  • Average time to close issues: N/A
  • Average time to close pull requests: 32 minutes
  • Issue authors: 3
  • Pull request authors: 1
  • Average comments per issue: 0.5
  • Average comments per pull request: 0.0
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • auzaheta (9)
  • marion-hoffman (2)
  • PatrickJEdwards (1)
  • eugeniagilpa (1)
  • jhollway (1)
Pull Request Authors
  • auzaheta (10)
Top Labels
Issue Labels
Type: Bug (5) Status: In Progress (5) Difficulty: Moderate (5) Type: Enhancement (3) Difficulty: Trivial (2) Status: Revision Needed (2) Type: Feature Request (2) Type: Question (1) Difficulty: High (1) Type: Maintenance (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 169 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 4
  • Total maintainers: 1
cran.r-project.org: goldfish

Statistical Network Models for Dynamic Network Data

  • Versions: 4
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 169 Last month
Rankings
Stargazers count: 6.6%
Forks count: 7.1%
Dependent packages count: 29.8%
Average: 30.9%
Dependent repos count: 35.5%
Downloads: 75.4%
Maintainers (1)
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.5.0 depends
  • Rcpp >= 1.0.1 imports
  • changepoint * imports
  • generics * imports
  • ggplot2 * imports
  • methods * imports
  • stats * imports
  • tibble * imports
  • utils * imports
  • broom * suggests
  • covr * suggests
  • devtools * suggests
  • ggraph * suggests
  • igraph * suggests
  • knitr * suggests
  • migraph * suggests
  • pixiedust * suggests
  • rmarkdown * suggests
  • testthat * suggests
.github/workflows/R-CMD-check.yml actions
  • actions/checkout v3 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yml actions
  • JamesIves/github-pages-deploy-action 4.1.4 composite
  • actions/checkout v3 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/prchecks.yml actions
  • actions/cache v1 composite
  • actions/checkout v3 composite
  • actions/upload-artifact v1 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
.github/workflows/pushrelease.yml actions
  • actions/checkout v3 composite
  • actions/checkout master composite
  • actions/download-artifact v2 composite
  • actions/upload-artifact v1 composite
  • actions/upload-release-asset v1.0.2 composite
  • anothrNick/github-tag-action 1.39.0 composite
  • ncipollo/release-action v1 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite