1. Introduction, and installing python for healthcare modelling


This site is a collection of code snippets that help me use Python for health services research, modelling and analysis. When learning something new I always work on a small code example to understand how something works, and to keep as a handy reference.

I will be looking at data handling, some statistics, data plotting, discrete event simulation, and machine learning.

I will be including use of pure Python as well as commonly used libraries such as NumPy, Pandas, MatPlotLib, SciPy, SciKitLearn, TensorFlow and Simpy.

Everything described here is performed in Python 3, based on the Anaconda Scientific Python environment, available for free (for Windows, Mac or Linux).

Anaconda comes with its own environments for writing the code: Spyder or Jypyter Notebooks. Both are nice. Other Free and Open Source options are PyCharm for more functionality, Atom or Visual Studio Code for a modern code text editor, or Vim for a more old-fashion but very fast and lightweight code text editor.

Occasionally other free libraries may be installed. If so they will be described where appropriate.

I choose to do all my work in GNU/Linux, but everything should also work in Microsoft Windows or Mac OS.

If you are new to this I would recommend installing the Anaconda Scientific Python environment, and then look for ‘Spyder’ in your computer’s application listing. That will open up an ‘Integrated Development Environment’ (IDE): a posh phrase that means a place where you can both write and run code.

For a quick introduction to using Spyder to code Python, see:

Happy coding!