Skip to content

borismus/inequality-simulator

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.

Wealth inequality simulator

This is a tool for creating simple simulations of wealth inequality. Each simulation consists of rules and households. As the simulation unfolds, rules are executed in order, and each rule is applied to each household, affecting household wealth. Here is the definition of a simple simulation, in which two households have different incomes:

var rules = [
  {label: 'Salary', action: 'this.total += 2 * this.incomeMultiplier'},
  {label: 'Spending', action: 'this.total -= 1'},
];
var simulation = new Simulation(rules);
simulation.addActor({
  label: 'Low income',
  incomeMultiplier: 1,
});
simulation.addActor({
  label: 'High income',
  incomeMultiplier: 2,
});

This code is lifted from this simulation file. The simulation file can be loaded by passing it in as a GET argument, using a URL like this one: https://borismus.github.io/inequality-simulator/?model=1-world-income-ineq-doesnt-lead-to-wealth-ineq.js.

Which results in the following output:

Screenshot of simulation

For more info, please read the blog post here: http://smus.com/simulating-wealth-inequality

About

Simulating wealth inequality

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published