Numerical Methods and Optimization in Finance
The book explains tools for computational finance with emphasis on simulation and optimization ... more information about 'Numerical Methods and Optimization in Finance'
The manual describes how to use the NMOF package, which accompanies the book 'Numerical Methods and Optimization in Finance' by Manfred Gilli, Dietmar Maringer and Enrico Schumann. This is currently a draft, and comments are very welcome.
Papers appear in the year in which they have been published, unpublished reports when they were first circulated.
A note on 1/N and minimum-variance portfolios, and the fact that significance tests do harm (and no good) in financial decision-making
DeMiguel et al. (2009) have shown that an equal-weight portfolio strategy performs well when compared with more sophisticated portfolio-selection models. Unfortunately, a number of people have interpreted their conclusion as 'you cannot beat 1/N'. In this note I argue that DeMiguel et al. (2009) have actually provided further evidence that long-only minimum-variance is an advisable investment strategy (which should be preferred to 1/N).
Take-the-Best in Portfolio Selection
A well-known result in portfolio optimisation states that as the number of assets in a portfolio grows, the variance of portfolio return approaches the average covariance between the included assets. I argue that this result should not be read as a justification to emphasise forecasting correlations. I compare the textbook recipe for constructing the minimum-variance portfolio, which uses the full variance-covariance matrix, with a simple, sorting-based rule. Through a simulation I show that when there is diversity in the cross-section of assets and we cannot precisely predict future covariance (two empirically valid assumptions), then the simple rule is rarely worse (and if, not much) than the textbook approach, but often better.
Better Portfolios with Options
As a result of the recent financial crises, equity markets have performed poorly in the last five years or so. In consequence, equity long-only strategies have generally been unattractive over this period. This motivates the investigation on whether better performance can be achieved by including equity options in the portfolios. We show that simple systematic option strategies improve portfolio performance. Results are supported by thorough backtesting and simulations.
Heuristic Optimisation in Financial Modelling
There is a large number of optimisation problems in theoretical and applied finance that are difficult to solve as they exhibit multiple local optima or are not 'well-behaved' in other ways (eg, discontinuities in the objective function). One way to deal with such problems is to adjust and to simplify them, for instance by dropping constraints, until they can be solved with standard numerical methods. We argue that an alternative approach is the application of optimisation heuristics like Simulated Annealing or Genetic Algorithms. These methods have been shown to be capable of handling non-convex optimisation problems with all kinds of constraints. To motivate the use of such techniques in finance, we present several actual problems where classical methods fail. Next, several well-known heuristic techniques that may be deployed in such cases are described. Since such presentations are quite general, we then describe in some detail how a particular problem, portfolio selection, can be tackled by a particular heuristic method, Threshold Accepting. Finally, the stochastics of the solutions obtained from heuristics are discussed. We show, again for the example from portfolio selection, how this random character of the solutions can be exploited to inform the distribution of computations.
Large-Scale Portfolio Optimisation with Heuristics
Heuristic optimisation techniques allow to optimise financial portfolios with respect to different objective functions and constraints, essentially without any restrictions on their functional form. Still, these methods are not widely applied in practice. One reason for this slow acceptance is the fact that heuristics do not provide the 'optimal' solution, but only a stochastic approximation of the optimum. For a given problem, the quality of this approximation depends on the chosen method, but also on the amount of computational resources spent (e.g., the number of iterations): more iterations lead (on average) to a better solution. In this paper, we investigate this convergence behaviour for three different heuristics: Differential Evolution, Particle Swarm Optimisation and Threshold Accepting. Particular emphasis is put on the dependence of the solutions' quality on the problem size, thus we test these heuristics in large-scale settings with hundreds or thousands of assets, and thousands of scenarios.
FX Trading: An Empirical Study
Given a set of tick-by-tick data of five currency pairs we analyze several traditional asset allocation techniques as well as technical trading rule based models. In particular we explore appropriate levels of time aggregation and rebalancing frequencies. We also suggest a triggered rebalancement strategy which results in better performance and lower transaction costs. For the asset allocation approach multiple objectives are optimized using heuristic optimization techniques.
Heuristic Methods in Finance
Heuristic optimization methods and their application to finance are discussed. Two illustrations of these methods are presented: the selection of assets in a portfolio and the estimation of a complicated econometric model.
An alleged weakness of heuristic optimisation methods is the stochastic character of their solutions: instead of finding the truly optimal solution, they only provide a stochastic approximation of this optimum. In this paper we look into a particular application, portfolio optimisation. We demonstrate that the randomness of the ‘optimal’ solution obtained from the algorithm can be made so small that for all practical purposes it can be neglected. The relationship between in-sample fit and out-of-sample performance is not monotonous, but still, we observe that up to a point better solutions in-sample lead to better solutions out-of-sample. Beyond this point, however, there is practically no cause for improving the solution any further, since any in-sample improvement will, out-of-sample, only lead to financially meaningless improvements and unpredictable changes (noise) in performance.
Constructing 130/30-Portfolios with the Omega Ratio
We construct portfolios with an alternative selection criterion, the Omega function, which can be expressed as the ratio of two partial moments of a portfolio's return distribution. The main purpose of the article is to investigate the empirical performance of the selected portfolios, especially the effects of allowing short positions. Many studies on portfolio optimisation assume that short sales are not allowed. This is despite the fact that theoretically, short positions can improve the risk-return characteristics of a portfolio, and practically, institutional investors can and do sell stocks short. We investigate whether removing the non-negativity constraint really improves out-of-sample portfolio performance under realistic assumptions, that is when optimal weights need to be estimated from the data and different transaction costs apply to long and short positions.
Calibrating Option Pricing Models with Heuristics
Calibrating option pricing models to market prices often leads to optimisation problems to which standard methods (like such based on gradients) cannot be applied. We investigate two models: Heston's stochastic volatility model, and Bates's model which also includes jumps. We discuss how to price options under these models, and how to calibrate the parameters of the models with heuristic techniques. Sample MATLAB code is provided.
Distributed Optimisation of a Portfolio's Omega
We investigate portfolio selection with alternative objective functions in a distributed computing environment. In particular, we optimise a portfolio's 'Omega' which is the ratio of two partial moments of the returns distributions. Since finding optimal portfolios under such performance measures and realistic constraints leads to non-convex problems, we suggest to solve the problem with a heuristic method called Threshold Accepting (TA). TA is a very flexible technique as it requires no simplifications of the problem and allows for a straightforward implementation of all kinds of constraints. Applying this algorithm to actual data, we find that TA is well-adapted to optimisation problems of this type. Furthermore, we show that the computations can easily be distributed which leads to considerable speedups.
Optimisation in Financial Engineering
We discuss the precision with which financial models are handled, in particular optimisation models. We argue that precision is only required to a level that is justified by the overall accuracy of the model, and that this required precision should be specifically analysed, so to better appreciate the usefulness and limitations of a model. In financial optimisation, such analyses are often neglected; operators and researchers rather show an a priori preference for numerically-precise methods. We argue that given the (low) empirical accuracy of many financial models, such exact solutions are not needed; ‘good’ solutions suffice. Our discussion may appear trivial: everyone knows that financial markets are noisy, and that models are not perfect. Yet the question of the appropriate precision of models with regard to their empirical application is rarely discussed explicitly; specifically, it is rarely discussed in university courses on financial economics and financial engineering. Some may argue that the models’ errors are understood implicitly, or that in any case more precision does no harm. Yet there are costs. We seem to have a built-in incapacity to intuitively appreciate randomness and chance; all too easily then, precision is confused with actual accuracy, with potentially painful consequences.
Replicating Hedge Fund Indices with Optimization Heuristics
Hedge funds offer desirable risk-return profiles; but we also find high management fees, lack of transparency and worse, very limited liquidity (they are often closed to new investors and disinvestment fees can be prohibitive). This creates an incentive to replicate the attractive features of hedge funds using liquid assets. We investigate this replication problem using monthly data of CS Tremont for the period of 1999 to 2009. Our model uses historical observations and combines tracking accuracy, excess return, and portfolio correlation with the index and the market. Performance is evaluated considering empirical distributions of excess return, final wealth and correlations of the portfolio with the index and the market. The distributions are compiled from a set of portfolio trajectories computed by a resampling procedure. The nonconvex optimization problem arising from our model specification is solved with a heuristic optimization technique. Our preliminary results are encouraging as we can track the indices accurately and enhance performance (e.g. have lower correlation with equity markets).
Calibrating the Nelson–Siegel–Svensson model
The Nelson–Siegel–Svensson model is widely-used for modelling the yield curve, yet many authors have reported 'numerical difficulties' when calibrating the model. We argue that the problem is twofold: firstly, the optimisation problem is not convex and has multiple local optima. Hence standard methods that are readily available in statistical packages are not appropriate. We implement and test an optimisation heuristic, Differential Evolution, and show that it is capable of reliably solving the model. Secondly, we also stress that in certain ranges of the parameters, the model is badly conditioned, thus estimated parameters are unstable given small perturbations of the data. We discuss to what extent these difficulties affect applications of the model.
Implementing Binomial Trees
The paper details the implementation of binomial tree methods for the pricing of European and American options. Pseudocode and sample programs for MATLAB and R are given.
An Empirical Analysis of Alternative Portfolio Selection Criteria
In modern portfolio theory, financial portfolios are characterised by a desired property, the 'reward', and something undesirable, the 'risk'. While these properties are commonly identified with mean and variance of returns, respectively, we test alternative specifications like partial and conditional moments, quantiles, and drawdowns. More specifically, we analyse the empirical performance of portfolios selected by optimising risk-reward ratios constructed from these alternative functions. We find that these portfolios in many cases outperform our benchmark (minimum-variance), in particular when long-run returns are concerned. However, we also find that all the strategies tested seem quite sensitive to relatively small changes in the data. The main theme throughout our results is that minimising risk, as opposed to maximising reward, often leads to good out-of-sample performance. In contrast, adding a reward-function to the selection criterion improves a given strategy often only marginally.
Constructing Long/Short Portfolios with the Omega Ratio
We construct portfolios with an alternative selection criterion, the Omega function, which can be expressed as the ratio of two partial moments of the returns distribution. Finding Omega-optimal portfolios, in particular under realistic constraints like cardinality restrictions, requires to solve non-convex optimisation problems. Since standard (gradient-based) optimisation methods fail here, we suggest to use a heuristic technique (Threshold Accepting). The main purpose of the paper is to investigate the empirical performance of the selected portfolios, especially the effects of allowing short positions. Many studies on portfolio optimisation assume that short sales are not allowed. This is despite the fact that theoretically, short positions can improve the risk-return characteristics of a portfolio, and practically, institutional investors can and do sell stocks short. We investigate whether removing the non-negativity constraint really improves out-of-sample portfolio performance under realistic assumptions, that is when optimal weights need to be estimated from the data, different transaction costs apply to long and short positions or short selling is restricted to specific assets.
R packages and examples
Software used in papers/books
- The NMOF package can be obtained from R-Forge; see the package's manual and NEWS file.
- All other code examples from Gilli/Maringer/Schumann (2011) are available from the book's website.
- MATLAB code for 'A Data-Driven Optimization Heuristic for Downside Risk Minimization' (Journal of Risk 8(3), 2006, pp. 1-18) can be downloaded from the COMISEF homepage
- MATLAB and R functions for 'Implementing Binomial Trees' are available from the COMISEF homepage.
- MATLAB and R functions for 'Calibrating Option Pricing Models with Heuristics' are available from the COMISEF homepage.
- R functions for 'Calibrating the Nelson–Siegel–Svensson model' are available from the COMISEF homepage.
- R function for 'A note on "good starting values" in numerical optimisation' are available from the COMISEF homepage.
I am currently responsible for research/quantitative strategies at an investment advisory in Switzerland. I hold a PhD in econometrics, an MSc in economics and a bachelor's degree in economics and law.