Tools for programming in applied statistics
Programming is a science in itself, to which people devote entire careers
(lifes?). Settling for much less, we will "simply" use it as a tool to
analyse data. The use will be very basic, though you will find, that
while you may know all the parts of an analysis program, putting it
together is not that simple and first of all requires experience. That
is what this course is meant to give you.
I've chosen to use Python, as it is relatively easy, gives very useful
error messages and is in general very flexible and "forgiving". Also,
it does not require compilation.
But Python in itself does not come with a good graphics/histogramming
part (though this can be obtained) and is not capable of the delicate
art of minimization, i.e. fitting (this is hard to obtain).
For these reasons, we use the statistics and graphics package ROOT
from CERN. ROOT makes it simple to produce histograms and graphs,
and to fit these with any function of your choice. It also allows
for many other things, not the least producing figures of publication
quality.
Python introduction:
During the course there will be one problem set to be solved, two
projects to be carried out, and a final take-home exam to be handed
in, all of which can (in due time) be found on the course webpage.
To prepare for this, you might want to take a look the following two
resources:
Python Introduction from WikiMedia
(for Python 2.6, but the better of the two).
Python
Introduction from Oxford (especially chapter 3).
For the purpose of knowing what to aim for, here is a list of what you
should be able to do:
Read in data from an text file (i.e. numbers in rows).
Define and use variables of types boolean, integer, float and character.
Make for-loops (e.g. loop over the data).
Make if-statements. (e.g. decide if a variable is above some value).
Print numbers to the screen and possibly into an output file.
Produce plots (histograms, graphs, scatter plots).
ROOT introduction:
Importing ROOT into Python gives you a powerful tool for data
analysis. Below are some introductions to ROOT (by others), but apart
from the first (gentle) introduction, they are probably best read,
once you have a program running, for example the
Prime number
calculation and fitting.
Furthermore, the tutorial
pages of ROOT contains many useful examples.
Gentle introduction to ROOT.
ROOT for beginners.
ROOT for beginners - Day 1.
ROOT for beginners - Day 2.
ROOT for beginners - Day 3.
ROOT for beginners - Day 4.
ROOT for beginners - Day 5.
ROOT Tips and Tricks.
Again, for the purpose of knowing what to aim for, here is a list of what you
should be able to do in ROOT (after a week or two):
Be able to define, fill and plot histograms.
Be able to produce and plot graphs.
Fit histograms and graphs with any function of your choice.
Finally, some of the most commonly used ROOT objects are listed here:
ROOT 1D histogram, TH1.
ROOT 1D graph, TGraphErrors.
ROOT 1D function, TF1.
ROOT math, TMath.