View Full Version : MATLAB, R, C/C++, Java, Python ..etc


spooky
01-23-2004, 07:04 PM
Excel/VBA is pretty much THE software in actuarial work. I am just wondering if anyone have experience of using MATLAB (http://www.mathworks.com/products/industry/fin_industry/), R (http://www.r-project.org/) and other packages such as SAS (www.SAS.com), S+ (http://www.insightful.com/products/splus/), Octave (http://www.octave.org/), Scilab (http://scilabsoft.inria.fr/), Mathematica (http://www.wolfram.com/products/mathematica/), C/C++, Java (http://java.sun.com/), Python (http://www.python.org/), Fortran, Crystal Ball (http://www.decisioneering.com/crystal_ball/), @Risk (http://www.palisade.com/), SPSS (http://www.spss.com/) ..etc in actuarial work.

Please provide some insights under the following headings:

1. How easy is it to pick up these packages?
2. What do you use them for?
3. How easy are they to blend in with Excel/VBA?
4. How quick are they when performing MC simulations compare to Excel?
5. What are the pros and cons of them.

Thank you very much!

SamChevre
01-23-2004, 10:37 PM
Wrong premise. SAS and APL are "the software" for actuarial work. Excel is used when talking to accountants.

Modeler
01-24-2004, 03:01 AM
C, C++, Java, Python, Fortran are full-fledged languages, not "packages". C++ and Java in particular are very complex if you count all the standard libraries.

These are for real programmers, not actuaries.

E. Blackadder
01-24-2004, 07:40 AM
SAS and APL for doing real work. VBA is for when management is unwilling to spend money to do the job right.

Brad Gile
01-24-2004, 07:58 AM
Man, there's a lot of trolling going on here!

Brad<---slips out the door quietly :)

Oblomov retired (student)
01-24-2004, 08:44 AM
Quite a list. Ok, I'll bite. I have used most of these (both actuarial and non-actuarial work)

How easy is it to pick up these packages?
That of course depends on your background, R, S+, Matlab and Mathematica (and arguably, Excel as well) are all functional programming languages. VBA, C/C++, Java, Python and Fortran are procedural. For both groups applies that once you know a few of these langauges, picking up an extra one is fairly easy. Your VBA knowledge is pretty useless for learning S, though. R and S+ both share the same programming language, S. Crystal Ball and @Risk are excel Add-ons. You are forgetting SQL. I cannot stress enough that C++ is hard, if you need something like it, choose java or c#.

What do you use them for?
Ehm, work? (Sorry)

How easy are they to blend in with Excel/VBA?
Broad question. Each of the above can read/write text files, which is good enough to transfer data between them, what else would you need? If by "blend in" you mean that you want to add menus and buttons to Excel, stick to VBA.

How quick are they when performing MC simulations compare to Excel?
I couple of years ago I have reimplemented a SAS simulation (5-10 iterations per second) into Excel (1-3 iterations per second), Mathematica (1 iteration per second) and C++ (5,000-20,000 iterations per second). If speed is your only issue and you don't know what a stack frame, alloca or radix sort is, hire a C++ programmer, otherwise stick with one of the other tools.
Functional programming lanuages are usually pretty bad for MC due to a lack of control over how they store data.

What are the pros and cons of them.
All these tools/languages have their applications.
1. Stick to what you know
2. Pick the right tool for the job
For actuaries, I find that 1. and 2. are mutually exclusive, that's where I come in :-)

E. Blackadder
01-24-2004, 11:31 AM
did you try VBA? I'm sure C++ is faster...

spooky
01-24-2004, 12:39 PM
Thank you Obolomiv.

The reason I started this thread was to see if anyone want to share their experience of non-spreadsheet software. I am currently looking at alternatives to Excel for certain jobs as we are trying to be more "scientific" with our modelling process and hope one day Excel is only used for simple calculation and presenting results. From the lack of response I guess most people are not using these software extensively.

In our office, Excel and R are widely used. We also have some people using SAS for data manipulation and GLM. I normally use R for my empirical data analysis/plotting graphs and using Excel/VBA for my simulations. I am currently looking into the possibility of using Matlab for our simulations. It seems to be strong in matrix operations, so potentially it can be use for curve fitting too.

SAS is nice statistical software with lots of built-in modules. But I doubt it is the best software around for doing simulations.

Do people still use APL? It's an old language and I have a feeling that Matlab can do most of what APL can do.

As with C/C++ and other languages, I am not considering them as, like modeler was implying, it is hard to find a programmer and an actuary in the same person. It's therefore hard to push people to use a programming language like C/C++ in an actuarial department. I am interested to know how people use it in actuarial work though.

Java maybe an option as I heard it's simpler to learn and it does crisp graphics too. Then we are happy with the graphs R/Excel produced.

I've been told that Python is a great object-oriented scripting language and there is a great support from the open-source community. It also has lots of extensions similar to what Matlab does, that's why I am keeping an eye on its development. But I don't think we'll consider even testing its use any time sooner.

Cho Da
01-24-2004, 05:57 PM
it is hard to find a programmer and an actuary in the same person.We do exist, though.

Brad Gile
01-24-2004, 08:13 PM
it is hard to find a programmer and an actuary in the same person.We do exist, though.

Indeed. I think, in fact, that there are a lot more of us than you might think. :)

One product (other than a programming language) that I think is highly useful is Mathcad. Mathcad is designed to be an engineer's notepad that will solve an incredible array of mathematical problems. It is a poor man's Mathematica (though it is getting more expensive over time). I have been using various versions of it since 1988.http://www.mathsoft.com


Brad

Brad Gile
01-24-2004, 08:29 PM
All these tools/languages have their applications.
1. Stick to what you know
2. Pick the right tool for the job
For actuaries, I find that 1. and 2. are mutually exclusive, that's where I come in :-)


Trolls piss me off.
Ach, well!
I agree with (1) and (2) as axiomatic. The statement in bold, however,
is awfully cocky. I'll go so far as to say it is nonsense.
So you are not an actuary, huh? :)



Brad

Obi-Wan Kenobi
01-24-2004, 08:47 PM
One product (other than a programming language) that I think is highly useful is Mathcad. Mathcad is designed to be an engineer's notepad that will solve an incredible array of mathematical problems. It is a poor man's Mathematica (though it is getting more expensive over time). I have been using various versions of it since 1988.http://www.mathsoft.com

Open Source fanatics (I can't believe Cho Da and glen have missed this already) may want to try GNU Octave (http://www.octave.org/).

torrent
01-24-2004, 11:14 PM
"Java maybe an option as I heard it's simpler to learn and it does crisp graphics too. Then we are happy with the graphs R/Excel produced. "



Isn't Java on its way out? Use C# instead (I assume your company is a microsoft shop).

Oblomov retired (student)
01-25-2004, 07:25 AM
All these tools/languages have their applications.
1. Stick to what you know
2. Pick the right tool for the job
For actuaries, I find that 1. and 2. are mutually exclusive, that's where I come in :-)


Trolls piss me off.
:roll: insert "often", look at smiley. Lighten up.

Don't go around calling people Trolls, it's an insult.

SamChevre
01-25-2004, 09:07 AM
Thank you Obolomiv.

The reason I started this thread was to see if anyone want to share their experience of non-spreadsheet software. I am currently looking at alternatives to Excel for certain jobs as we are trying to be more "scientific" with our modelling process and hope one day Excel is only used for simple calculation and presenting results. From the lack of response I guess most people are not using these software extensively.


SAS is nice statistical software with lots of built-in modules. But I doubt it is the best software around for doing simulations.

Do people still use APL? It's an old language and I have a feeling that Matlab can do most of what APL can do.



I'm not familiar with MatLab (I know what it is but haven't used it); I can definitely say that APL is still quite commonly used. Our whole valuation shop is built around a core of APL files and programs. We use Access and Excel for querying against common subsets of the information.

APL is unlike any other language in which I have programmed in its syntax, but I consider it the easiest to program of any language I've seen. It is very much based on linear algebra; the further you get from matrices and vectors, the more difficult doing the work in APL becomes; if you stay in a matrix/vector world, though, it is easy to program and quite fast to run. (I inherited an updateable, queryable database built in APL which may have been the most disfunctional and user-unfriendly piece of **** I've ever encountered.) It is also slower than more up-to-date languages, which control memory usage better; that is only an issue when you do a lot of manipulation on large quantities of data (100,000 x 1,000 or greater). (The flip side is that you don't have to learn all the control structures for memory usage before being able to work effectively.)

I used SAS for simulations in college; it seemed to be very capable at them, although it isn't as good as the dedicated simulation programs like PTS. You are correct in your assessment--it's big strength is that it has so many pre-built statistical routines. I haven't used it in a work environment, although some of my colleagues use it.

Cho Da
01-25-2004, 10:30 PM
One product (other than a programming language) that I think is highly useful is Mathcad. Mathcad is designed to be an engineer's notepad that will solve an incredible array of mathematical problems. It is a poor man's Mathematica (though it is getting more expensive over time). I have been using various versions of it since 1988.http://www.mathsoft.com

Open Source fanatics (I can't believe Cho Da and glen have missed this already) may want to try GNU Octave (http://www.octave.org/).I've seen it, but since I have MatLab on my PC at work, I haven't ever gotten around to installing Octave. I really wouldn't have much use for it at home...

Brad Gile
01-26-2004, 01:04 PM
Excel/VBA is pretty much THE software in actuarial work.


Excel is a superb tool for analyzing relatively small amounts of data and producing excellent presentation results for same. Typically, other tools are used to extract summaries from large files to be used as Excel input.
Excel can also, via COM automation, be used purely as an output device to hold summary results.

Excel is a poor choice for:
1. Holding and processing large data sets.
2. Scientific calculations that require high precision.
3. Programming that requires high speed processing.
4. Extensive use of Monte Carlo simulation.

MS has extremely talented people, but scientific computing has always gotten short shrift from them in Excel. If you use Excel 2003, stay away from the RAND() worksheet function-it is fatally flawed. Instead, use VBA and its Rnd function. Better still, don't use Excel at all for simulation. Use a programming language - VB6, VB.NET, C#, C++, etc and dump the results into Excel if you want. :)


Brad

GadgetGeek
01-26-2004, 01:32 PM
I agree with Brad's comment to a degree...
Those other tools make sense, IF you can convince the powers that be to let you have them. Otherwise you are stuck trying to work miracles with VBA in Access and Excel.

Will Durant
01-26-2004, 01:33 PM
it is hard to find a programmer and an actuary in the same person.We do exist, though.

Indeed. I think, in fact, that there are a lot more of us than you might think. :)
:wave:

Brad Gile
01-26-2004, 05:33 PM
I agree with Brad's comment to a degree...
Those other tools make sense, IF you can convince the powers that be to let you have them. Otherwise you are stuck trying to work miracles with VBA in Access and Excel.

Heh. Absolutely. In fact, I have a hard enough time convincing people that VBA is worthwhile learning!! :swear:
Ach, well! In 4 years, 7 months....:)

Brad

StephenLL
01-27-2004, 03:15 PM
I've been using Matlab in insurance for about 9 years. Here are my answers to your questions:

Please provide some insights under the following headings:

1. How easy is it to pick up these packages?
For Matlab there is a little learning curve since you are now dealing primarily with matrices, but that's about it.

2. What do you use them for?
Everything from Fourier Transforms, simulation, curve fitting, cash flow analysis, etc... Reinsurance, insurance, etc...

3. How easy are they to blend in with Excel/VBA?
Well we primarily use excel as an input and output mechanism only. All calculation are done in matlab. Once you purchase the matlab compiler and com builder it is very painless.

4. How quick are they when performing MC simulations compare to Excel?
I have personally seen matlab run a fraction (as in 1/20 and smaller) then excel. On the order of c and c++

5. What are the pros and cons of them.
Pros: Great language for prototyping and building, fast, promotes reuse of components, the list goes on and on
Cons: Something else to purchase, you must start thinking like a programmer rather then just throwing some vba code together

I hope this helps. PM me if you want to discuss further.

spooky
01-30-2004, 06:56 PM
Thank you all for your contributions, they are very helpful. I must say that I was shocked when I checked the price of Matlab. Even @Risk is not cheap. I definitely need to put a strong case of why I cannot use Excel/Access/VBA/SAS/R to do the job.

SamChevre
01-30-2004, 07:09 PM
If you have SAS, you've got close to the ultimate tool. It really does almost anything you would want done, fairly well.

SAS is expensive enough that we don't have it commonly available here, but I think it would be superior to most of the programs you mention for most purposes.

oedipus rex
02-02-2004, 02:52 PM
has anyone used J?

JTBenson
02-05-2004, 07:28 PM
To make Matlab effective, you must have support at the company level. We have just purchased licenses for it and are starting to build components. Eventually, Matlab will be the company standard. Every model will have calculations done by Matlab. In my opinion, it is well worth the money, but may not be justifiable in a small company.

Cho Da
02-06-2004, 09:35 AM
Thank you all for your contributions, they are very helpful. I must say that I was shocked when I checked the price of Matlab. Even @Risk is not cheap. I definitely need to put a strong case of why I cannot use Excel/Access/VBA/SAS/R to do the job.You complain about the price of MatLab, but not of SAS? Do you have naughty pictures of your SAS sales droid?

Anyway, check out Octave (http://www.octave.org/) if you want a MatLab work-alike for much less money.