Revolution R in Financial Applications
The R language is a very popular data analysis, statistics, and visualization system with a large and rapidly-growing user-base in the quantitative finance and risk analysis fields. Across the industry, R is at the cutting edge of financial analysis research.
Portfolio Design, Optimization & Stability Analysis
Ever-increasing data volumes and model complexity often force practitioners to limit their use of high-level languages like R to prototyping environments, relying on lower-level languages for production use. However, models built in C, C++, Fortran, Java, and even F# are often slow to deploy, costly to produce, and more error-prone than algorithms developed in high-level environments like R.
The Revolution R product family from Revolution Analytics includes high-performance numerical methods, commercial support, training, and developer tools that enhance the R language for both rapid prototyping and production environments in quantitative finance and risk analysis. Visit our white papers for examples of the speed advantages made possible by employing Revolution R.
Revolution R can improve the performance of real-world applications significantly . For example, some components of the CreditMetrics R package exhibit nearly 16x performance speedups using Revolution R on standard x86 workstations. Revolution R Enterprise includes groundbreaking, easy-to-use tools for parallel and distributed computing with R that can scale out many algorithms across multiple workstations, clusters and grids.
Why is the R Language so Well-Suited to Finance?
Revolution R is a powerful platform for rapidly solving questions in quantitative finance, econometrics and risk analysis. Revolution R excels not only as a sophisticated and easy-to-use "What if?" prototyping tool, but algorithms developed with Revolution R Enterprise are also production-capable—due to its expert technical support, performance enhancements and visual development tools.
Applications of R in Finance
Contributed packages for R span every application in finance, including:
Financial Data: Time series (regular and irregular); financial calendars; database query; access to financial data sources Yahoo, Bloomberg, FAME, Interactive Brokers and more.
Financial instruments: options, bonds, yield curves, portfolios, technical trading rules.
Time Series: Classical time series analysis (ARIMA, Kalman filters); volatility modeling (incl. GARCH); unit root and cointegration tests; dynamic models; wavelet analysis; and more.
Risk management: Value at Risk, cVaR, Credit Risk, quantitative risk modeling, portfolio optimization.
Econometrics: generalized linear regression, quantile regression, generalized additive models, microeconomic models.
Financial analytics: Simulation, backtesting, regression, copulas, random matrix theory, stochastic differential equations, factor analysis, actuarial methods, constrained optimization.
Huge User Community
Analysts and statisticians in business, government, academia, and the open-source community have contributed hundreds of high-quality functions to the R language for quantitative finance and optimization, risk analysis, financial graphics, and financial data source connectivity. All standard quant and risk models are already available in R, providing end-users with a large high-quality code library on which to build even more sophisticated models.
The following basic examples illustrate the powerful connectivity, graphics and simple syntax of the R language.
Simple and expressive syntax
Revolution R includes powerful data connectivity methods and first-class time-series objects out of the box. The following is from the Quantmod package:
# Pull down some historic stock OHLC data from a Web Services source: getSymbols("MSFT") # Let's take a look at the last three months: chartSeries(MSFT, subset='last 3 months')
# Retrieve a different time series: getSymbols("IBM")
# Merge the two time-series (no need to worry about alignment or uniformity # of the time index--that is handled transparently and efficiently): x <- as.xts(merge(IBM, MSFT)) # Time-series are indexed by actual POSIX dates. x['2008-11-01::2008-11-07']
IBM.Open IBM.High IBM.Low IBM.Close IBM.Volume IBM.Adjusted 2008-11-03 92.64 94.67 92.17 92.68 7686300 92.16 2008-11-04 94.76 94.76 92.07 93.40 10173000 92.88 2008-11-05 92.93 93.40 89.70 89.94 8706200 89.44 2008-11-06 87.68 88.83 84.28 85.15 12522000 85.15 2008-11-07 85.78 86.71 84.25 86.27 7927800 86.27 MSFT.Open MSFT.High MSFT.Low MSFT.Close MSFT.Volume MSFT.Adjusted 2008-11-03 22.48 22.91 22.21 22.62 61923500 22.47 2008-11-04 23.13 23.66 22.87 23.53 72123000 23.37 2008-11-05 23.33 23.34 22.05 22.08 81179700 21.93 2008-11-06 21.87 22.08 20.86 20.88 95509700 20.74 2008-11-07 21.32 21.54 21.00 21.50 71256300 21.36
Here is a compelling two-liner from the Performance Analytics package: