Blog Archives

Plotting forward curves with R

March 23, 2014
By
Plotting forward curves with R

I wanted to have an idea of the general form of the forward curve for London ICE gasoil futures contracts along the year. The R code below plot a forward curve for each month throughout the time series. Data were … Continue reading →

Read more »

Least-Squares and Maximum Likelihood Estimation calibration with R

November 17, 2013
By
Least-Squares and Maximum Likelihood Estimation calibration with R

In this short post, we give the code snippets for both the least-square method (LS) and the maximum likelihood estimation (MLE). They are based on Calibrating the Ornstein-Uhlenbeck (Vasicek) model at www.sitmo.com. One can also read the article On the Simulation and Estimation … Continue reading →

Read more »

The forward (explicit) Euler method

December 31, 2012
By
The forward (explicit) Euler method

The forward (explicit) Euler method is a first-order numerical procedure for solving ODEs with a given initial value. The forward Euler method is said to be the simplest and most obvious numerical ODEs integrator. In fact, the simulation using the forward Euler only … Continue reading →

Read more »

Bivariate normal distribution with R

September 21, 2012
By
Bivariate normal distribution with R

Exercise: Plot a bivariate normal distribution for simulated data, , and . As explained on Mathworld, the bivariate normal distribution is the statistical distribution with probability density function: where: and, with ‘real’ data: Here, we will impose . We are free to … Continue reading →

Read more »

An implementation of the Newton-Raphson algorithm in C/C++ and R

September 14, 2012
By
An implementation of the Newton-Raphson algorithm in C/C++ and R

Today, we write a small piece of C/C++ code that implements the well-known Newton-Raphson algorithm (see, Mathworld). We also provide the R code. Exercise: Find the unique root of the function  using the Newton-Raphson method. Notice that we choose a function … Continue reading →

Read more »

PDF and CDF for normal distributions with R

September 10, 2012
By
PDF and CDF for normal distributions with R

Below, we give the R code to plot the PDF and the CDF for normal distributions. We wish to get charts quite similar to the ones read on Wikipedia (Normal Distribution). The resulting charts are shown at the bottom. Notice that … Continue reading →

Read more »

Generation of correlated random numbers: recommended article

February 29, 2012
By
Generation of correlated random numbers: recommended article

This quick blog entry to share an excellent article of Thijs van den Berg entitled Generating Correlated Random Numbers. This author describes in a nicely way how to generate sequences of correlated random numbers using the Cholesky decomposition, and a Eigenvector … Continue reading →

Read more »