{"id":17161306,"url":"https://github.com/andreas-bauer/monte-carlo-sim","last_synced_at":"2025-04-13T14:11:41.536Z","repository":{"id":127476193,"uuid":"471773824","full_name":"andreas-bauer/monte-carlo-sim","owner":"andreas-bauer","description":"Markov Chain Monte Carlo (MCMC) Simulation with Metropolis Algorithm","archived":false,"fork":false,"pushed_at":"2023-12-04T08:14:14.000Z","size":2191,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-27T05:12:40.623Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/andreas-bauer.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}},"created_at":"2022-03-19T18:00:49.000Z","updated_at":"2024-01-25T08:30:23.000Z","dependencies_parsed_at":"2023-12-01T17:38:02.202Z","dependency_job_id":null,"html_url":"https://github.com/andreas-bauer/monte-carlo-sim","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreas-bauer%2Fmonte-carlo-sim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreas-bauer%2Fmonte-carlo-sim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreas-bauer%2Fmonte-carlo-sim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreas-bauer%2Fmonte-carlo-sim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andreas-bauer","download_url":"https://codeload.github.com/andreas-bauer/monte-carlo-sim/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248724629,"owners_count":21151561,"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-10-14T22:27:52.067Z","updated_at":"2025-04-13T14:11:41.515Z","avatar_url":"https://github.com/andreas-bauer.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Markov Chain Monte Carlo (MCMC) Simulation with Metropolis Algorithm\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"islands.png\"\u003e\u003c/p\u003e\n\n## Introduction\n\nThis is an implementation of the MCMC simulation with Metropolis algorithm example from the Statistical Rethinking [1] book (chapter 9.1 page 265) in Go.\n\nKing Markov wants to visit every 10 islands of his kingdom regularly.\nHe wants to visit islands were with a bigger population and therefore with more people who love him more often than smaller islands.\nThe second island is twice as popular as the first, the third is three times as popular as the first, and so on.\nUsing MCMC allows the king to visit the islands depending on the popularity without scheduling every trip in advance.\n\n### References\n\n[1] McElreath, R. (2020). Statistical rethinking: A Bayesian course with examples in R and Stan. Chapman and Hall/CRC.\n\n## Run Simulation\n\n`go run ./main.go` creates a `barchart.png` as shown in the result section.\n\nYou can change the vars `numWeeks` and `numIslands` to adjust the simulation. But plotting is only possible for 10 islands.\n\n\n## Results\n\nThis is the resulting bar chart after 100000 (1e5) weeks.\n\n![Simulation](1e5_weeks.png)\n\n## License\n\nCopyright © 2022-2023 Andreas Bauer\n\nThis work (source code) is licensed under  [MIT](./LICENSE).\n\nLogo is generated with DALL·E 3.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreas-bauer%2Fmonte-carlo-sim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreas-bauer%2Fmonte-carlo-sim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreas-bauer%2Fmonte-carlo-sim/lists"}