GithubHelp home page GithubHelp logo

inheritance's Introduction

Inheritance simulation

An agent-based model simulating the UK population, focusing on the effects of inherited wealth.

Requirements

  • Python 2.7
  • Packages listed in requirements.txt

Running the simulation

Before your first run, initialise the data:

python data.py

To run the simulation:

python adapter.py model.yaml

Outputs

Running the simulation produces an output.h5 HDF5 file, containing the following tables:

  • data: top-level data at each tick (year) of the simulation
  • by_age: data subdivided by the age of the agents, at each tick
  • history: full history of each agent through the simulation
  • skill_dist: number of agents at each skill level at each tick
  • tree: full list of family links between pairs of agents
  • trusts: data on each inheritance trust at each tick

A function is provided for plotting the life history of an individual agent:

import pandas as pd
import sinks

data = pd.HDFStore('output.h5')

sinks.plot_history(data, 123)

Input parameters

Parameters of the model are set in model.yaml. Under control_parameters you can set the number of ticks and number of agents. The available model_parameters are:

  • inheritance: type of inheritance, "direct" or "trust"
  • trust_first_generation: first generation to benefit from trusts (1 = children)
  • trust_last_generation: last generation to benefit from trusts (1 = children)
  • assortative_mating: strength of assortative mating (0 = none, 1 = very strong)
  • savings_rate: fraction of income that gets saved
  • interest_rate: interest rate for wealth and trusts

Files

  • README.md: this file
  • requirements.txt: python packages required
  • raw_data/*/*.xls: raw data from the ONS and census
  • data.py: script for processing raw data into numpy arrays
  • model.yaml: model specification
  • inheritance.py: core model logic
  • adapter.py: wrapper for inheritance.py that loads in the data and parameters
  • scenarios.py: initialises agent population
  • sinks.py: processes output data

inheritance's People

Contributors

james-t-allen avatar

Watchers

 avatar  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.