Financial Engineering and Computational Finance with R Rmetrics Built 221.10065
Total Page:16
File Type:pdf, Size:1020Kb
Rmetrics An Environment for Teaching Financial Engineering and Computational Finance with R Rmetrics Built 221.10065 Diethelm Würtz Institute for Theoretical Physics Swiss Federal Institute of Technology, ETH Zürich Rmetrics is a collection of several hundreds of functions designed and written for teaching "Financial Engineering" and "Computational Finance". Rmetrics was initiated in 1999 as an outcome of my lectures held on topics in econophysics at ETH Zürich. The family of the Rmetrics packages build on ttop of the statistical software environment R includes members dealing with the following subjects: fBasics - Markets and Basic Statistics, fCalendar - Date, Time and Calendar Management, fSeries - The Dynamical Process Behind Financial Markets, fMultivar - Multivariate Data Analysis, fExtremes - Beyond the Sample, Dealing with Extreme Values, fOptions – The Valuation of Options, and fPortfolio - Portfolio Selection and Optimization. Rmetrics has become the premier open source to download data sets from the Internet. The solution for financial market analysis and valu- major concern is given to financial return series ation of financial instruments. With hundreds of and their stylized facts. Distribution functions functions build on modern and powerful methods relevant in finance are added like the stable, the Rmetrics combines explorative data analysis and hyperbolic, or the normal inverse Gaussian statistical modeling with object oriented rapid distribution function to compute densities, pro- prototyping. Rmetrics is embedded in R, both babilities, quantiles and random deviates. Esti- building an environment which creates especially mators to fit the distributional parameters are for students and researchers in the third world a also available. Furthermore, hypothesis tests for first class system for applications in statistics and the investigation of distributional properties, of finance. correlations, of dependencies and of other stylized facts of financial time series returns can fBasics also be found in this package. The package fBasics covers the basic ma- fCalendar nagement of economic and financial market data. Included are example data sets and S functions The core fCalendar functions are the S4 for collecting, archiving and characterizing "timeDate" and "timeSeries"classes to manage economic and financial time series. Especially date and time around the globe for any financial the S functions should be mentioned which allow center. The concept allows for dealing with time zones, day light saving time and holiday analysis. Offered are algorithms for regression calendars independent of the date and time analysis including neural network modelling specifications of the operating system implemen- with feedforward networks. Furthermore, func- ted on your computer. The time zone concept is tions for sytem equation modelling in the context replaced by the "Financial Center" concept. The of demand and supply models are available. financial center specifies where you are living Technical analysis and benchmarking is another and working. With the specification of the major issue of this package. The collection offers financial center the system knows what rules for a set of the most common technical indicators to- day light saving times should be applied or what gether with functions for charting and per- is your holiday calendar. An important feature is formance measurements. For the technical ana- the fact that Rmetrics uses the ISO-8601 lysis of markets several trading functions are standard for date and time notations but also implemented and also tools are availalble for a makes date transformations possible. The S4 rolling market analysis. A matrix addon with "timeSeries" class manages regular and irregular many functions which allow an easy use of time series objects. Included are functions and matrix manipulations is also part of this package. methods for the generation, representation and This addon includes functions to generate several mathematical manipulation of time series kind of standard matrixes, to extract subsets of a objects. For local date and time management a matrix, and some function from linear algebra. holiday database for all ecclesiastical and public This matrix addon is thought to be used to holidays in the G7 countries and Switzerland is manipulate easily the data of multivariate time provided together with a database of daylight series objects. saving times for financial centers around the world. Special calendar management functions fExtremes were implemented to create easily business and holiday calendars. This package covers topics from the field what is known as extreme value theory. The package has fSeries functions for the exploratory data analysis of extreme values in insurance, economics, and This package covers topics from the field of finance applications. Included are plot functions financial time series analysis including ARIMA, for empirical distributions, quantile plots, graphs GARCH, long memory modelling, and chaotic exploring the properties of exceedences over a time series analysis. The pac-kage tries to bring threshold, plots for mean/sum ratio and for the together the content of existing R-packages with development of records. Furthermore, functions additional new functionality on a common plat- for preprocessing data for extreme value analysis form. The collection comes with functions for are available offering tools to separate data be- simulations, parameter estimation, diagnostic yond a threshold value, to compute blockwise analysis and hypothesis testing of financial time data like block maxima, and to de-cluster point series. The tests include methods for testing unit process data. One major aspect of this package is roots, independence, normality of the distribu- to bring together the content of the already tion, trend stationary, and neglected non-line- existing R-packages, evir and ismev with addi- arities. In addition functions for testing for tional new functionality for financial engineers higher serial correlations, for heteroskedasticity, on a common platform investigating fluctuations for autocorrelations of disturbances, for linearity, of maxima, extremes via point processes, and the and functional relations are provided. Further- extremal index. more, distribution functions for GARCH mode- ling like the normalized Student-t and the GED fOptions together with their skewed versions have been added. It is also worth to mention that an R- The fOptions package covers the valuation of interface for the Ox/G@RCH software package options including topics like the basics of option is available. pricing in the framework of Black and Scholes, including almost 100 functions for exotic options fMultivar pricing, including the Heston-Nandi option pricing approach mastering stochastic volatility, This package deals mainly with multivariate and Monte Carlo simulations together with aspects of economic and financial time series generators for low discrepancy sequences. Beside the Black and Scholes option pricing Summary formulas, functions to valuate other plain vanilla options on commodities and futures, and Rmetrics is a collection of R functions having its function to approximate American options are source in algorithms and functions written by available. Some binomial tree models are also many authors. The aim is to bring the software implemented. The exotic options part comes together under a common platform and to make with a large number of functions to valuate it public available for teaching financial en- multiple exercise options, multiple asset options, gineering and computational finance. The lookback options, barrier options, binary options, packages are docu-mented in User Guides and Asian options, and currency translated options. Reference Guides, currently about 800 pages. Furthermore, S functions are provided to in- vestigate and analyze exponential Brownian The most recent source packages of Rmetrics motion including functions dealing with moment and the compiled Windows binaries can be matching methods, PDE solvers, Laplace in- obtained from the Rmetrics Server. The reason is version methods, and spectral expansion ap- that I develop Rmetrics under MS Windows XP proaches. since in the financial community Windows is the mostly used operating system. Stable source fPortfolio packages for Linux and binaries for Mac OSX and MS Windows are downloadable from the The fPortfolio package deals with portfolio CRAN Server. In addition Debian packages for selection, optimization and benchmarking. Rmetrics are also available and they are part of Included are S functions for multivariate the Knoppix Qantian CD. distributions, for assets modeling, for Value-at- Risk computation, and for performance measures including drawdown statistics. S functions for the modeling of assets allow to compute fat- tailed and skewed multivariate densities and Acknowledgement: probabilities. Furthermore, the distributional parameters of assets can be estimated and Many thanks to the members of the R development artificial sets with the same statistical properties team for their support and continuous help, to all the can be generated. In addition assets can be authors who made their programs and R-packages selected and grouped using hierarchical and k- available under the GNU General Public License so means clustering approaches. Value-at-Risk that they could be used or included to Rmetrics, and Modeling is considered as another important to Dirk Eddelbuettel for creating the Debian