StatTools : Python Explained and Code Fragments

Links : Home Index (Subjects) Contact StatTools

Introduction Source Codes
Introduction Data I/O

Python is a programming language very similar to C. Python is free, but offers many mathematical and statistical resources that are available from expensive softwares such as Matlab, SAS, and Stata. Because of this, Python is popular with engineers and web developers. Python is also very easy to learn, and there is a very large supportive user network on the www.

StatTools uses Python initially to access complex multivariate statistical routines, but over time accumulated short code segments that may be useful for those who wish to build their own statistical resources.

Python is too big and too complex a subject to explain in this particular web site. For the beginner, https://www.python.org/ is the Python Home Page, from which downloads, tutorials, and other resources can be obtained.

Installing Python

Python was originally designed to run on the DOS. After downloading the installer from https://www.python.org/ and installing Python on the computer, an experienced programmer or engineer will open a DOS box and run Python without any difficulty. For users who are not professional programmers, and who are used to running things on a GUI, a better interface would be useful, and a common interface is Anaconda, accessible from https://www.anaconda.com/download/.

Anaconda is a large framework which provides at least 4 programming interfaces, and allows downloads of many other supportive facilities. My favourite programming interface is SPYDER, which contains a console very similar to any text editor, and allows any program written to run immediately, producing results in a results panel.

Most Python codes offered from StatTools are therefore developed in the SPYDER client, and instructions on programming offered assumes that the user will be using SPYDER.

Python codes from StatTools

Short snippets of codes are offered as subroutines. Longer codes that perform a complete set of analysis (e.g. codes for logistic regression) are offered as a complete program. Most codes can be copied and pasted into the SPYDER consol and run immediately.

StatTools assumes that the user will have at least beginner's skills in programming, and is either already familiar with Python, or is able and willing to learnit from the resources offered from https://www.python.org/. There is no specific instructions on how to program in Python from StatTools