Friday 8 October 2010

Book Review: R in a Nutshell


R in a Nutshell includes a quick introduction to the R statistical software; so if you are new to working with R you can catch up in a few pages. But it also is a full reference for the R programming language and a great variety of R packages which are available.

More in detail, it includes a description of the R syntax, objects, functions, saving and loading data, and graphics as well as more advanced topics like object-oriented programming and high-performance R. The packages that it presents deal with basic statistics, probability distributions, statistical tests, and power tests. The packages for regression models go further to nonlinear models, splines, smoothing as well as machine learning algorithms like neural networks, and support vector machines for regression. The classification models that the book describes include linear models as well as nearest neighbors, random forests and other algorithms. A chapter is devoted to time series analysis.

Finally a complete example is presented for a bioconductor application. I think that the book makes a good desktop quick reference. Of course it does not captures all subjects possible, for example solving ODEs with R is possible, but the variety of R packages are so great that in a book one has to concentrate on the most important parts.

Thursday 7 October 2010

Fibonacci retracement

Fibonacci numbers are the legendary sequence 0, 1, 1, 2, 3, 5, 8, 11, ... , named after Leonardo of Pisa, also known as Fibonacci, filius Bonacci, "son of Bonaccio". The sequence is given by the recursive formula:
F_n = F_{n-1} + F_{n-2},\!\,
with starting values:
F_0 = 0 \quad\text{and}\quad F_1 = 1.
As you can imagine Fibonacci numbers have also application in economics. Here is what wikipedia* says:

"In financial mathematics, Fibonacci retracements are a method of technical analysis. They are named after their use of the Fibonacci sequence. Fibonacci retracement levels are based on Fibonacci ratios.

Fibonacci retracement is based on the idea that markets will retrace a predictable portion of a move, after which they will continue to move in the original direction.

These pullbacks are often traded or used as an opportunity to position for the direction of the original move.

Fibonacci retracements occur at distinct levels of the original move. Each Fibonacci level is considered to be an area where the market will likely find levels of support or resistance.

The four basic Fibonacci retracement levels are calculated as 23.6%, 38.2% 50.0% and 61.8%, signifying the portion of the move in the opposite direction of the original move. 0.0% is considered to be the start of the retracement, while 100.0% is a complete reversal to the original part of the move."


But what about the tribonacci numbers? These are similar to the Fibonacci numbers but including three terms in the sum. Do they have an application in finance? And what about the generalization of this sequence?


* This content is available under the Creative Commons Attribution-ShareAlike License.

Wednesday 6 October 2010

Black-Scholes coupled system



In the previous post we have seen a simple example of the Black-Scholes equation, where a single option have been considered. What happens in the case where more than options have to be studied at the same time? Well, simple extend the model to many variablesas following:
The coefficients σ, μ and r are of course different between the two equations. However, one can simply raise the question what happens when a coupling of the two dependent variables takes place. At the beginning we can assume a simple linear coupling of the two prices which will then lead to the Black-Scholes system:
As we can see now both prices u1 and u2 appear in both equations. This means that we need some robust and at the same time flexible numerical method for the solution of the above system, which leads us of course to the finite element method.

The Black-Scholes equation


The Black-Scholes equation is a parabolic partial differential equation (PDE) for option prices discovered by Black and Scholes in 1973. This discovery revolutionized financial markets in 1990-s. In 1997 Merton and Scholes were awarded the Nobel prize in economics. For any stock price s,
and time t,
the price u for an option expiring at time T satisfies the following Black-Scholes PDE:
where σ(s,t) is the volatility coefficient,
and μ and r are respectively the risk neutral drift and risk free interest which are assumed to be constants.