{"id":21010891,"url":"https://github.com/miserman/simulation_demo","last_synced_at":"2026-04-21T08:32:44.252Z","repository":{"id":231357912,"uuid":"781578145","full_name":"miserman/simulation_demo","owner":"miserman","description":"Demo of a live-running agent-based model","archived":false,"fork":false,"pushed_at":"2024-04-10T18:28:20.000Z","size":1990,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-20T11:13:31.243Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://miserman.github.io/simulation_demo/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/miserman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-04-03T16:41:35.000Z","updated_at":"2024-04-03T16:43:06.000Z","dependencies_parsed_at":"2024-04-10T19:46:14.988Z","dependency_job_id":null,"html_url":"https://github.com/miserman/simulation_demo","commit_stats":null,"previous_names":["miserman/simulation_demo"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miserman%2Fsimulation_demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miserman%2Fsimulation_demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miserman%2Fsimulation_demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miserman%2Fsimulation_demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/miserman","download_url":"https://codeload.github.com/miserman/simulation_demo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243438002,"owners_count":20290862,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T09:24:19.249Z","updated_at":"2025-12-26T09:44:03.377Z","avatar_url":"https://github.com/miserman.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Demo of a live-running agent-based model based on [Hammond \u0026 Ornstein, 2014](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4133329/).\n\n# Implementation\n\nThe model is primarily implemented in the [lib/agent.ts](lib/agent.ts) file. The `rollValue` function determines the initial distribution of values, and the `rollConnections` function determines the social environment. The `step` function determines how agents gather information and adjust their values.\n\nThe [lib/population.ts](lib/population.ts) file runs the model by generating agents with specified parameters, then executing their `step` functions in a random order with its own `step` function.\n\n## Execution\n\nModels are run from two types of web workers. The primary worker ([app/workers/liveWorker.ts](app/workers/liveWorker.ts)) runs the live-running model. This executes population steps every 100 milliseconds, and sends the updated population to the app every epoch. The batch worker ([app/workers/batchWorker.ts](app/workers/batchWorker.ts)) is spawned for each model variant from the batch runner. These run the variant without timing, collect population averages after each epoch, and send back these and the initial and final population values for each run.\n\n# Analysis\n\nThe batch mechanism can be used to better see the effects of different parameters. For instance, this batch looks at the effects of agent tolerance (value sensitivity) and graph beta (rewire probability):\n\n\u003cimg src=\"figures/batch_trends.svg\" width=\"100%\"\u003e\n\u003cimg src=\"figures/batch_distributions.svg\" width=\"100%\"\u003e\n\nThis includes 4 model variants with different parameter combinations: **sensitive** means `agent tolerance = 0` whereas **insensitive** means `agent tolerance = .4`, and **clustered** means `graph beta = .1` whereas **spread** means `graph beta = .9`.\n\nFrom this, it seems that higher agent sensitivity (`tolerance = 0`; the lighter lines) leads to higher average population values, and higher clustering (`graph beta = .1`; the green lines) leads to slightly more variation in final population values between runs.\n\nA notable property of this model is that values converge across the population to within agent tolerance, which means the original variation (and so, distribution) of the values is lost. If the value is representing an observed feature with the initial distribution, this is probably unrealistic. The agents' `error proportion` parameter adds one way to preserve some variation by adding a random value to each agent's value with each step. This could be thought of as representing all other sources of variation outside of movement toward a norm, though that movement still normalizes the distribution.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiserman%2Fsimulation_demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiserman%2Fsimulation_demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiserman%2Fsimulation_demo/lists"}