A Psychologically-Motivated Model of Opinion Change with Applications to American Politics
- Install Python 2.7.X (https://www.python.org/downloads/) and Git (https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
- Open a terminal (Max/Linux) or a command prompt (Windows)
- Clone the repository:
- Install with Pip (OR python):
- cd isc
- pip install .
- (python setup.py develop)
- Install missing packages if necessary
- The SciPy Stack: Matplotlib, Numpy, Scipy, and Pandas (https://www.scipy.org/install.html)
- Seaborn (https://stanford.edu/~mwaskom/software/seaborn/installing.html)
- Optional packages required for fit_empirical_ISC: 'hyperopt' which can be installed through Git (https://github.com/hyperopt/hyperopt); 'MongoDB', a parallelization package for hyperopt (https://github.com/hyperopt/hyperopt/wiki/Parallelizing-Evaluations-During-Search-via-MongoDB)
- 'agent.py' is the python class for agents, and contains all the important equations
- 'model.py' is the main file, which imports the experimental parameters, initializes the simulation, runs it, exports the data, and plots pretty pictures
- 'parameters.txt' is the masin parameter file for model.py. Written in dictionary format for easy import/export.
- 'fit_empirical.py' is the optimization algorithm used to find parameters which reproduced the empirical data.
- 'fit_parameters.txt' is the parameter file for 'fit_empirical'.
- 'broockman_data.txt' and 'pew_data.txt' are the empirical data files, also in dictionary format.
- 'data' folder is where model outputs are saved. Each is saved into a subfolder with a randomly-generated name
- 'figures' includes the parameters, data, and figures for the results reported in the paper
- Navigate to the 'isc/isc' folder in the terminal/cmd
- Edit the 'parameters.txt' file
- Be sure to reset the seed to get unique behavior.
- run 'python model.py'
- You should see the message 'Running Simulation...' followed by a progress indicator
- When the simulation finishes, check out the 'data' folder to see your results.
- Email '[email protected]'