From: Ted Harding (Ted.Harding@nessie.mcc.ac.uk)
Date: Mon 26 Apr 2004 - 06:14:51 EST
I used Matlab starting in about 1990 then later (since about 1993)
octave which I then stuck with without reverting to Matlab. Like you,
since starting to get used to R I now rarely use octave (at any rate
Some comments below to add to those of others. These mainly refer to
octave, since I have not been in contact with Matlab for a good few
On 25-Apr-04 Tamas Papp wrote:
> The department of economics at our university (Budapest) is planning a
> course on numerical methods in economics. They are trying to decide
> which software to use for that, and I would like to advocate R. The
> other alternative is Matlab.
> 1. How "smart" the language is. R appears to be a nice functional
> programming language, is Matlab comparable? Last time I used Octave,
> it seemed to be little more than syntactic sugar on some C/Fortran
> libraries. It appears to me that using R gradually pushes people
> towards better programming habits, but I may be biased (I am a Scheme
I think you are being unfair on Matlab/octave, which has a full
programming language with a very healthy supply of builtin routines
for numerical operations on matrices and vectors. However, their main
programming resources are of the kind assignment, looping,
conditionals, etc. rather like C itself. Primitve types are also
somewhat limited -- manily integers, reals, complex, and vectors
and 2-D arrays of these, and "structures" which are basically lists
of items each of which can be any of these types (access using
C-like "." notation). Nevertheless these are enough to develop
a great variety of applications.
I don't know what the situation now is with Matlab, but octave has
long suffered from not supporting arrays with more than 2 dimensions,
which somewhat impedes its use for many statistical purposes, though I
think the issue has been recently addressed in a more constructive
fashion. You can emulate multidimensional arrays as structures,
computing an index into a vector (linear array of elements):
There has for quite some time been an offshoot of octave called
"TeLa" ("Tensor Language") of which details can be found at
(According to the changelog on this site the latest version is
2.0 of August 2002). This was specifically written to support
multidimensional arrays because of fmi.fi (Finnish Meteorological
Institute)'s interest in complex multidimensional dynamics.
It is quite easy to write "scripts" which define functions and
implement complex programs using builtin and user-defined functions.
Anything in Statistics which can be expressed in terms of vectors
and matrices can easily be implemented in Matlab/octave. For a good
few years I did all my statistical computing on Matlab, then octave.
However, R beats either in terms of the flexibility and depth
that the language offers. This however makes it a considerably
more formidable learning task to get full benefit from it.
> 2. Learning curve. If somebody could share his/her experience on
> using R or Matlab or both in the classrom, how students take to it.
No comment here for classrom use (except in the background for
demonstration -- I haven't taught students how to use either for
their own work, though I have tuaght PhD students how to use
octave/Matlab and it worked well. I think at some of these might
not have got on too easily with R.
However, one point to consider is the graphical capabilities of
Matlab/octave vs R. Probably matlab has come a long way on this
front since I used to use it, but even in its early days it
offered a wider range of graphics than octave did. Octave has
always done graphics by creating files of commands which it
submits to gnuplot, so it is limited by what the capabilities
of gnuplot are at the time. On the other hand, you can suss out
how octave does this and write your own scripts for implementing
graphics in other commandfile-driven graphics programs (I once did
this for Kenny Toh's now apparently dormant[*] PlotMTV, and it has
also been done for PLPlot -- quite effectively in my view; you could
even write an octave interface to R graphics if you wanted!).
[*] Not further developed since about 1977, I think, though a
very useful program.
> 3. Which language do you think is better for students' further
> development? We would like to equip them with something they can use
> later on in their career even if they don't become theoretical
> economists (very few undergraduate students do that).
This has to depend on your judgement as to which language better
provides the tools they will need in that field (or may be further
developed to provide them).
Matlab/octave are particularly well equipped to handle "signal
processing" types of computation, especially with their special
"toolboxes" -- assemblages of supplementary functions written
for these purposes. This includes all kinds of filters, spectral
analyses, etc. You can also readily supplement these with routines
for additional analyses. As pointed out above, a lot of statistical
analyses can be programmed by someone who knows what they are doing.
They are also very well adapted for modelling and simulation, both
deterministic and stochatic, and come equipped with solvers for systems
of differential equations (non-linear as well as linear) and numerical
On the other hand, R is remarkable for its very broad coverage of
different types of statistical analysis and model-fitting.
Probably either is equally straightforward to use for basic work.
For more advanced or complex work it may be better to use both,
each for the kind of task it is better equipped for.
> 4. How flexible are these languages when developing new
> applications/functions? Very few of the problems I encounter have a
> ready-made solution in a toolbox/library.
In my experience, Matlab/octave -- because of the essential simplicity
of both the programming language and the primtiive data types,
is easiest and simplest for developing new applications or functions,
provided you know well what it is you want to implement. But you
may have to do a lot of work on the detail.
On the other hand, R's complexity of language structure and richness
of objects and types offers great flexibility with little effort
provided you are familiar enough with its resources. I personally
find that a lot of the time and effort I spend when developing
applications goes on developing this familiarity.
On a sort of analogy, working with Matlab/octave could be likened to
working on an older (non-electronic) car: so long as you have good
mechanical sense, are handy with a few tools, and are prepared
to undo a lot of nuts and bolts, it is straightfoward though
Working with R is sometimes more like neurosurgery: you have to become
aware of the existence of the particular structure you need to deal
with, where to locate it, and what its function is in relation to
other structures; and, when you have finally reached it, you may need
to handle it with delicacy and finesse!
Hoping this is useful!
E-Mail: (Ted Harding) <Ted.Harding@nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 167 1972
Date: 25-Apr-04 Time: 21:14:51
------------------------------ XFMail ------------------------------
Rfirstname.lastname@example.org mailing list
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
This archive was generated by hypermail 2.1.3 : Mon 03 May 2004 - 18:41:23 EST