MATLAB or R? Which works best in Value-at-Risk calculation?

12.7.2017

 

Peter Verhoog of Verhoog Consultancy and Techila Technologies have published a paper that demonstrates, how to speed up the calculation of Value-at-Risk measures using scalable distributed computing. The MATLAB and R codes have also been made open and available for the financial community.

A common risk measure in the finance industry is Value-at-Risk (VaR). VaR measures the amount of potential loss that could happen in a portfolio of investments over a given period, with a certain confidence interval. It is used widely within the industry from trading environments to Solvency II, the regulatory framework for the insurance industry.

When dealing with complex portfolios, a popular method for the calculation of VaR measures is Monte Carlo simulation. The downside of Monte Carlo simulation is that the VaR calculation will be computationally intensive. This can lead to a situation where the VaR figures can’t be calculated timely with the required level of accuracy.

MATLAB and R programming language are popular among financial engineers. Both languages and environments have their own strengths and weaknesses, and strong user communities. Because the calculation of VaR can be time-consuming, a common question in MATLAB vs. R discussions is the performance of MATLAB code and R code.

In this paper, Peter Verhoog demonstrates, how to speed up VaR calculation using the Techila Distributed Computing Engine. TDCE is a next generation grid that supports R language and MATLAB, and integrates directly with RStudio and MATLAB. The available MATLAB and R code examples enable performance comparison of the model in these two popular programming environments.

The results show that there are differences in the performance of R language and MATLAB. On the other hand, Techila Distributed Computing Engine is a next generation grid computing that makes it easy to scale out the processing. Power that is easily scalable will reduce the effect of MATLAB’s and R’s performance differences. When using Techila, the user can choose his or her weapon based on which has the most useful libraries, toolboxes and packages, which supports the fastest time-to-market, and which is best for the R&D innovation.

Download Peter Verhoog’s MATLAB code and R code.

More news