Skip to content

thomasfeliciani/scripts-NI-calibration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Latest update: 4 July 2023.

Calibrated repulsive influence model

This repository consists in the replication scripts for the following article:

  • Feliciani, T., Tolsma, J. & Flache, A. (2023). Ethnic segregation and spatial patterns of attitudes: studying the link using register data and social simulation. Journal of Computational Social Science. https://doi.org/10.1007/s42001-023-00216-9

The scripts run an empirically-seeded, spatially-explicit agent-based model (ABM) of opinion dynamics called "repulsive influence model" (aka “negative influence” model- or simply RI- or NI- model).

This code runs in R 4.2.0 (R Core Team, 2022).

Follows a description of the contents of this repository.

ODD protocol.docx

This document provides a description of the ABM and its implementation. It follows the standardized “ODD”(Overview, Design concepts, and Details) protocol by Grimm et al. (2010).

util.r

This script contains utility functions that are ancillary to the simulation model. Requires libraries: “ggplot2”, “ggpubr”, “ggmap”, and “ggsn”.

simulation.r

This script is the core of the ABM, as it defines the function that executes a simulation run. An usage example is provided at the bottom of the script.

Requires library: “ggplot2”.

Sources “util.r”.

The script also attempts to load the file containing the calibration data necessary to run the ABM: “./cityData/geodata_Rotterdam.RData”. Note: due to weight limitations, the file is not included in the repositoy, so the script will offer to download via download link.

plots.r

This script reproduces all figures used in the research paper, and so it also plots the simulation results.

Requires libraries: “ggplot2”, “gridExtra”, “reshape2” and “scales”.

The script also attempts to load the file containing the simulation results produced for the research paper, “./simOutput/completeDataset.RDATA”. Again due to weight limitations, this file is also not included in the repositoy but is available to download separately via public link. This will be provided by the script.

./battery/

This folder contains all R scripts and shell scripts used to run simulations in parallel on a compute cluster and to process its results. In essence, we used these scripts to execute parallel simulations of the ABM using various parameter configurations, and then to summarize the simulation results in one results data file (“./simOutput/completeDataset.RDATA”).

./cityData/

This folder is to store three kinds of contents, all pertaining to the empirical calibration of the ABM.

First, two publicly available dataset published by Statistics Netherlands (aka “CBS”):

These dataset are not included in the repository.

Second, a script “calibration.r”, that we used to extract the necessary (spatial) data from the two dataset and to save them into the third kind of file in this folder: “./geodata_Rotterdam.RData”. The file “geodata_Rotterdam.RData”, is the only content of this folder strictly needed for running the simulation model (see script “simulation.r” for download directions).

References

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published