Examples and tutorials for conducting monte-carlo simulation in Python.
The materials have been made available under an MIT license. The materials are as-is with no liability for the author. Please provide credit if you reuse the code in your own work.
Please feel free to use or adapt the code for your own work. But if so then a citation would be very much appreciated!
@software{opensciencenerd_montecarlo,
author = {Monks, Thomas },
license = {MIT},
title = {{An introduction to monte-carlo simulation in Python}},
url = {https://github.com/TheOpenScienceNerd/replications-algorithm}
}All dependencies can be found in binder/environment.yml and are pulled from conda-forge. To run the code locally, we recommend installing miniforge;
miniforge is Free and Open Source Software (FOSS) alternative to Anaconda and miniconda that uses conda-forge as the default channel for packages. It installs both conda and mamba (a drop in replacement for conda) package managers. We recommend mamba for faster resolving of dependencies and installation of packages.
navigating your terminal (or cmd prompt) to the directory containing the repo and issuing the following command:
mamba env create -f binder/environment.ymlActivate the mamba environment using the following command:
mamba activate mcRun Jupyter-lab
jupyter-lab.
├── binder
│ └── environment.yml
├── CHANGELOG.md
├── CITATION.cff
├── LICENSE
├── 01_mc_investment_decision.ipynb
├── 02_mc_newsvendor.ipynb
├── newsvendor.py
└── README.md
binder/environment.yml- contains the conda environment if you wish to work the models.01_mc_investment_decision.ipynb- an investment decision problem from Pidd (2004).02_mc_newsvendor.ipynb- a simple multi-period newsvendor problem monte carlo simulationnewsvendor.py- module containing newsvendor problem codeCHANGES.md- changelog with record of notable changes to project between versions.CITATION.cff- citation information for the package.LICENSE- details of the MIT permissive license of this work.