# Statistics software for basic undergrad lab

I'll have to perform some simple experiments, like measuring the period and damping of a pendulum, focal length of a lens, …

As a result I will end up with some X, Y data points and need to calculate derivation, means, kovariance and provide a fit for a liniarized function.

It explicitly says that we can use software or self written programs.

I could implement all the statistics formulas on the help sheet in say Python and run it, but that seems like a huge duplication of effort.

Is there software that would assist me with those kind of things?

I currently have:

• Mathematica
• Octave
• xmgrace
• (ROOT)
• Can you make the question more specific about what exactly your requirements are? For example (but not limited to), why are the programs you currently have access to insufficient for your purposes? Right now this is bordering on not-constructive territory, but there's definitely room to improve it. – David Z Feb 22 '12 at 12:10
• The programs that I have access to are more than up to that tasks, I am just wondering which would be a good one to start. Exploring stuff is great, but I need some results in a couple weeks. So I am looking for something that I can learn now and use in the future. – Martin Ueding Feb 22 '12 at 15:23
• OK, so define "good one to start". Again, the point is to make the question more precise. – David Z Feb 22 '12 at 18:28

I recommend using Octave (or Matlab, which is much more user-friendly but you will need a license). For every quantity that you mentioned there is a command in Octave and it is as simple as a=mean(y) or v=cov(x,y). Importing and exporting data is also very easy.

• Octave has proven itself very handy during the first lab, I'll continue to use it. Thanks for the hint! – Martin Ueding Apr 9 '12 at 12:48

For statistical analysis Gnumeric works very well, as it has passed a lot of statistical test. This report explains why it is a much better choice than Excel.

Of course there is also R, which is the largest free statistical package and is used in a lot of research areas.

Personally I think going the plain python route is also not a bad idea, as there is nothing going on "under the hood" and looking at and modifying the source code can be a great learning experience.

As an example this is a very basic implementation to calculate the sample standard deviation. It is not optimized to look pythonic or use many library functions but is very easy to understand. We start from the definition $$s = \sqrt{\frac{1}{N-1} \sum_{i=1}^N (x_i - \overline{x})^2}$$ and end up with the following piece:

import numpy as np

def sample_std_dev(samples):

N = len(samples)
mean = sum(samples)/N

summation = 0.0
for xi in samples:
summation = summation + (xi-mean)**2

# remember: (N-1) from Bessel's correction
std_dev = np.sqrt( 1.0/(N-1.0) * summation)

return std_dev

samples = np.array([2.1, 2.2, 2.0, 2.5, 2.3, 2.1])

std_dev = sample_std_dev(samples)

print("Sample standard deviation:")
print(std_dev)

• Also, going the Python route introduces you to Python projects like scipy, numpy, matplotlib, etc. I'm a big fan of sagemath (Python based) myself, but it's not for everyone. – AdamRedwine Feb 22 '12 at 12:43

I used Excel, it has all the functions needed for undergrads and is simple. Not to mention debugging equation entry was straightforward. But looking back I wish I had got to grips with something like Matlab earlier.

• Google Docs has some better functions than Excel IMHO. – Manishearth Feb 22 '12 at 11:28