File:Gamma-OU.png

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Original file (1,200 × 900 pixels, file size: 8 KB, MIME type: image/png)

Captions

Captions

Add a one-line explanation of what this file represents
Description A gamma-process (levy-process) and an OU process driven by it. and the mean of the invariant distribution
Date
Source created with GNU R, see source below
Author Thomas Steiner
Permission
(Reusing this file)
Thomas Steiner put it under the CC-by-SA 2.5.
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 2.5 Generic license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

R-source Code:

######################################################
### OU-levy processes ################################
# trajectory of an OU-process, driven by some levy process (bdlp; here cauchy or gamma)
## starting at time t=0 at Z_0=Z0 until time t=T in "steps" equidistant steps; mean reversion "mr"
## parameters of the distribution of the bdlp are stored in param
process.ou<-function(param=c(0,1),mr=1,T=1,steps=500,bdlp="cauchy",Z0=0) {
  dt=T/(steps-1)
  ou=array(Z0,dim=steps)
  if (bdlp=="cauchy") {
    dLt=rcauchy(steps-1, location=param[1], scale=param[2]*dt)
  } else if (bdlp=="gamma") {
    dLt=rgamma(n=steps-1, shape=param[1], scale=param[2]*dt)
  }
  for (tm in 1:(steps-1)) {
    ou[tm+1]=ou[tm]-mr*ou[tm]*dt+dLt[tm]
  }
  return (list(time=seq(0,T,length=steps),Lt=c(0,cumsum(dLt)),ou=ou))
}

set.seed(29011980)
time=seq(0,5.7,length=5000)

png("Gamma-OU.png",width=1200, height=900)
par(mfrow=c(2,1))

gou=process.ou(param=c(2.1,0.9),mr=1.3,T=max(time),steps=length(time),bdlp="gamma",Z0=1.1)
plot(gou$time,gou$Lt,type="p",pch=".",main="Gamma process",col="purple",xlab="",ylab="")
plot(gou$time,gou$ou,type="p",pch=".",main="Gamma-OU process",col="purple",xlab="",ylab="")
abline(h=2.1*0.9/1.3,lty="dotted",col="darkgrey") #mean of limit-distribution
dev.off()
 
This chart was created with R.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current15:46, 4 May 2007Thumbnail for version as of 15:46, 4 May 20071,200 × 900 (8 KB)Thire (talk | contribs)new version, code online
13:54, 4 May 2007Thumbnail for version as of 13:54, 4 May 20071,200 × 900 (12 KB)Thire (talk | contribs)now two graphs...
13:53, 4 May 2007Thumbnail for version as of 13:53, 4 May 20071,200 × 900 (12 KB)Thire (talk | contribs){{Information |Description = A gamma-process (levy-process) and an OU process driven by it. and the mean of the invariant distribution |Source = created with GNU R, see source below |Date = 4. may 2007 |Author = Thomas Steiner |Perm

There are no pages that use this file.