Giter Club home page Giter Club logo

abm_panelwaves's Introduction

ABM_PanelWaves

Source code for the simulation of respondents in a panel survey. The simulation consists of a python script and two sets of input data: The data on respondents (Survey_Data.dat) and the data on media input (Content_Data.dat). The simulation requires all three files in the same folder. Other files are not required and the script uses only basic libraries (time, math, random, os).

The data was collected in a three-wave panel survey and accompanying content analysis in the run-up of a referendum in Switzerland in 2006. The issue of the referendum was a more restrictive legislation concerning asylum seekers (pro: install more restrictive laws / con: prevent these laws).

The simulation used all respondents as agents with their respective attitudes and their location in Switzerland. At each point in time, each respondent consults the media outlets they have indicated to use and perceives the opinion of all other agents. From the bias in the media and their environment, each agent slightly adjusts their opinion. Opinion change is dependent on overall media and social impact and on individual susceptibility to influences and attitude strength. A genetic algorithm is used to find the parameter values that inform the ABM to behave as the respondents in the panel survey behaved over three waves. The algorithm uses the agreement of the final state of the simulation with the following wave of the survey as fitness measure to find the optimal parameters.

The repository contains several folders, each complete with one implementation of the genetic algorithm and an R-script that visualizes the results obtained from the simulation. The difference between the implementations just lies in parameter values specified at the beginning of the program and some changes in the R-scripts. The folders may also contain result tables created in previous runs of these scripts to demonstrate the outputs of the program:

  • Simulation_Naive_W1: This implementation starts with the null hypothesis of there not being any influence at all and updates this assumption. It is quite slow to converge on optimal values for all parameters. It eventually finds the optimal parameter values for the first panel interval between the first and second panel wave.
  • Simulation_BS_W1: This implementation starts with the optimal values for the first panel interval found by naive parameter search and updates the values to a sub-sample of the original sample over 70 generations before resetting the initial values and drawing another sub-sample. Repeating this routine 50 times, the standard error of parameter values become apparent.
  • Simulation_BS_W2: This implementation does the same thing as BS_W1 but for the second panel interval between the second and third panel wave.
  • Simulation_Integ_W1: This implementation starts with the null hypothesis of there not being any effects and updates it, similar to the Naive_W1 implementation. However, each generation of the evolutionary algorithm uses a different sub-sample of the original sample to prevent overfitting to one sample. This implementation is considerably faster than Naive_W1 and bootstrapping becomes obsolete.
  • Simulation_Integ_W2: This implementation does the same as Integ_W1 but for the second panel interval.
  • Visualization: This implementation does not use the genetic algorithm but just does one run of the simulation with specified parameters. In the end of the simulation, the final state of the opinion climate is visualized in pop-up containing a TkInter canvas. This script also allows for the storage of individual agent carreers.

Attached to the project you find a PDF (SimulatingGaps.pdf) containing a presentation given at the 2018 annual convention of the ICA. It contains additional information on the studies, the contents of the program and results from the simulations.

abm_panelwaves's People

Contributors

tarlanc avatar

Stargazers

wujlin avatar  avatar Jiaying Hu avatar carl colglazier avatar Lyndon avatar  avatar Yibei Chen avatar Hyunjin (Jin) Song avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.