[R] Variance gamma process simulation and plot

Maximilian Lklweryc maxlklweryc at gmail.com
Sun Nov 25 20:41:56 CET 2012


Hi,
I have simulated one possible path of a variance gamma process by the
following code:
vektor<-c(1:23)

S0=20
theta=0.01

v=5
sigma=0.1

vektor[1]<-S0

for (i in 2:23){
randomgamma<-rgamma(1, shape=1/v, scale = v)
randomnormal<-rnorm(1,mean=0,sd=1)
vektor[i]<-vektor[i-1]+theta*randomgamma+sigma*sqrt(randomgamma)*randomnormal
}

plot(c(1:23),vektor)
lines(c(1:23),vektor)

Now my problem is, that the plot does not look like a variance gamma
process, these should look like this:
http://en.wikipedia.org/wiki/File:Variance-Gamma-process.png
or this:
http://demonstrations.wolfram.com/TheVarianceGammaProcess/

So where is my mistake?

In general: Is what I am doing correct? I want to simulate a stock
path. The initial value of the stock is 20. Now, I want to simulate
different paths. What parameters should I use to get a realistic
result?

Thanks a lot for your helpt

(I am a student in finance)



More information about the R-help mailing list