Cont model – Part II

October 28, 2013

(This article was first published on R snippets, and kindly contributed to R-bloggers)

In my last post I have investigated properties of Cont model (you can download the paper here). Today I would like to show how we can use simulations to further simplify its analysis.

First let us start with the observation that the model does not really require two parameters d and l as they are directly linked. If we multiply d by 2 and divide l by 2 we obtain exactly the same simulated returns path (scaled by 2). Let me motivate this result using simulation. The code that performs verification is simple (for explanation of the code logic look at my previous post): <- function(, reps, n, d, l ,s) {
  tr <- rep(0, n)
  sig <- rnorm(reps, 0, d)
  r <- rep(0, reps)
  for (i in 1:reps) {
    r[i] <- (sum(sig[i] > tr) sum(sig[i] < (-tr))) / (l * n)
    tr[runif(n) < s] <- abs(r[i])
sim.points <- 100
d <- runif(sim.points, 0.002, 0.01)
l <- runif(sim.points, 5, 10)
s <- runif(sim.points, 0.01, 0.1)
m <- runif(sim.points, 1, 2) # comparison multiplier
seeds <- runif(sim.points)   # common random numbers seeds
range(mapply(function(d, l, s, m, seed) {
    r1 <-, 10000, 1000, d, l ,s)
    r2 <-, 10000, 1000, d / m, l * m ,s)
    range(r1 / m r2)

  }, d, l, s, m, seeds)) # -2.775558e-17  1.387779e-17

We can see that r1/m and r2 vectors are almost identical in all 100 simulations.

This finding means that we can limit ourselves to analysis of d*l product in simulation output analysis. So we go back to sim_output.txt file and modify the visualization as follows:

data.set <- read.table(“sim_output.txt”, head = T,
                       colClasses = rep(“numeric”, 4))
data.set$dl <- data.set$d * data.set$l
data.set$cs <- cut(data.set$s, seq(0.01, 0.1, len = 10))
data.set$cdl <- cut(data.set$dl, seq(0, 0.2, len = 11)) <- aggregate(k ~ cdl + cs, data = data.set, mean)

          xlab = “d * l”, ylab = “s”)

Here is the final plot showing average k as a function of d*l and s:

We can see that the model produces excess kurtosis when d*l is small. What does it mean? In this case we have low d and low l. So new incoming information has low standard deviation but daily returns are allowed to be large. The conclusion is that kurtosis will be present if there is low level of trading on the market (the sum sum(sig[i] > tr) + sum(sig[i] < (-tr)) is relatively low).

We will use simulation again to verify this hypothesis. Here is the code with added trading volume variable (t): <- function(, reps, n, d, l ,s) {
  tr <- rep(0, n)
  sig <- rnorm(reps, 0, d)
  r <- rep(0, reps)
  t <- rep(0, reps)
  for (i in 1:reps) {
    r[i] <- (sum(sig[i] > tr) sum(sig[i] < (-tr))) / (l * n)
    t[i] <- (sum(sig[i] > tr) + sum(sig[i] < (-tr))) / n
    tr[runif(n) < s] <- abs(r[i])
  c(kurtosis(r[]), mean(t[]))
sim.points <- 100
d <- runif(sim.points,0.001,0.01)
l <- runif(sim.points,5,20)
s <- runif(sim.points,0.01,0.1)
data.set <- mapply(function(d, l, s) {
    , 10000, 1000, d, l ,s)
            }, d, l, s)
data.set <- t(data.set)
colnames(data.set) <- c(“kurtosis”, “volume”)
data.set <- data.set[, 2:1]
par(mar=c(4, 4, 1, 1))

The resulting plot confirms our reasoning:

The final question, that I will leave open here, is whether the observed relationship is an artifact of the model or the relationship that currently I am working on to verify empirically.

To leave a comment for the author, please follow the link and comment on their blog: R snippets. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.


Mango solutions

RStudio homepage

Zero Inflated Models and Generalized Linear Mixed Models with R

Dommino data lab

Quantide: statistical consulting and training



CRC R books series

Six Sigma Online Training

Contact us if you wish to help support R-bloggers, and place your banner here.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)