[R] R vs Matlab {Re: R in Industry}
Martin Maechler
maechler at stat.math.ethz.ch
Thu Feb 8 16:53:39 CET 2007
>>>>> "Albr" == Albrecht, Dr Stefan (AZ Private Equity Partner) <stefan.albrecht at apep.com>
>>>>> on Thu, 8 Feb 2007 16:38:18 +0100 writes:
Albr> Dear all,
Albr> I was reading with great interest your comments about the use of R in
Albr> the industry. Personally, I use R as scripting language in the financial
Albr> industry, not so much for its statistical capabilities (which are
Albr> great), but more for programming. I once switched from S-Plus to R,
Albr> because I liked R more, it had a better and easier to use documentation
Albr> and it is faster (especially with loops).
Albr> Now some colleagues of mine are (finally) eager to join me in my
Albr> quantitative efforts, but they feel that they are more at ease with
Albr> Matlab. I can understand this. Matlab has a real IDE with symbolic
Albr> debugger, integrated editor and profiling, etc. The help files are
Albr> great, very comprehensive and coherent. It also could be easier to
Albr> learn.
Albr> And, I was very astonished to realise, Matlab is very, very much faster
Albr> with simple "for" loops, which would speed up simulations considerably.
Can you give some evidence for this statement, please?
At the moment, I'd bet that you use forgot to pre-allocate a
result array in R and do something like the "notorious horrible" (:-)
1-dimensional
r <- NULL
for(i in 1:10000) {
r[i] <- verycomplicatedsimulation(i)
}
instead of the "correct"
r <- numeric(10000)
for(i in 1:10000) {
r[i] <- verycomplicatedsimulation(i)
}
If r is a matrix or even higher array, and you are using rbind()
or cbind() inside the loop to build up the result,
the problem will become even worse.
Albr> So I have trouble to argue for a use of R (which I like) instead of
Albr> Matlab. The price of Matlab is high, but certainly not prohibitive. R is
Albr> great and free, but maybe less comfortable to use than Matlab.
Albr> Finally, after all, I have the impression that in many job offerings in
Albr> the financial industry R is much less often mentioned than Matlab.
Albr> I would very much appreciate any comments on my above remarks. I know
Albr> there has been some discussions of R vs. Matlab on R-help, but these
Albr> could be somewhat out-dated, since both languages are evolving quite
Albr> quickly.
Albr> With many thanks and best regards,
Albr> Stefan Albrecht
More information about the R-help
mailing list