views:

214

answers:

5

I have been using MATLAB for my work, but I have started learning Python lately. I employ statistical analysis, more precisely geostatistics, in my work. I was wanting to ask, from your perspectives, which one among the two languages is good for statistical analysis? What are the pros and cons, other than accessibility, for each?

+6  A: 

The SciPy and NumPy libraries for Python add in a ton of MatLab-equivalent functionality, to the point where it might very well have surpassed MatLab as a scientific-computing resource.

As a language, I'd say Python is (in my opinion) far superior - function definition, imports, et cetera are all a lot nicer to work with than MatLab's more primitive equivalents.

That said, there is a lot of pre-written MatLab code out there for analysis, given that it was such a mainstay for such a long time.

Amber
+2  A: 

SciPy, NumPy and Matplotlib.

OTZ
+3  A: 

I would pick Python because it can be a powerful as Matlab but is free. Also, you can distribute your applications for free and no licensing chains.

Matlab is awesome and expensive (it had a great statistical package) and it will glow smoother than Python in the beginning, but not so in the long run.

Now, if you really want the best solution then check out R, the statistical package which is de facto in the community. They even have a Python port for it. R is also free software.

Arrieta
+4  A: 

MATLAB

  • Good for beginners
  • Good for interactive sessions

Python (with SciPy)

  • Good for slightly experienced programmers
  • Good for creating reusable applications
  • Good for reading and exporting data files
  • Free of cost

If SciPy doesn't provide all the functionality out of the box, then you may have to go searching on the Internet. I am not an expert on geostatistics, but here is a mail with some starting pointers. http://mail.scipy.org/pipermail/scipy-user/2007-November/014434.html

I also heard that Python + R is good, but I haven't tried it.

EDIT: Add link to Python + R: http://rpy.sourceforge.net/

nielsle
Thanks nielsle. Great answer. Can you tell what do you mean by the combination of (python + R)?
Harpreet
Ok. Thanks for the link!
Harpreet
Thanks.. and good luck :). By the way I probably made the differences look a little sharper than they really are. You can write complicated programs in Matlab, and python is a fairly good language for beginners. Furthernore python does provide interactive sessions.
nielsle
I object to "Slightly prettier graphs". Matplotlib produces equally pretty (often even prettier) graphs than matlab. With Matplotlib, you can even embed mathematical formulas with latex-like syntax, which matlab is unable to do.
OTZ
Fair enough. I'll remove the item.
nielsle
@OTZ: MATLAB does have a LaTeX interpreter: http://www.mathworks.com/help/techdoc/ref/text_props.html#f68-591188
Amro
@nielsle: You mention R. I have used it and I feel like it's about halfway in between Matlab and Python. It's free and closer to a "real" programming language than Matlab, but it's still very strange-looking and hard to use if you're used to general-purpose languages.
dsimcha
+3  A: 

You should definitely check out Sage, it is a pre-integrated Python and many of the major maths/science oriented libraries and frameworks. From the website:

Mission: Creating a viable free open source alternative to Magma, Maple, Mathematica and Matlab.

Gaius
Thanks for the info!
Harpreet