Tag Info

Hot answers tagged

7

Take a look at the sde package; specifically the dcOU and dsOU functions. You may also find some examples on the R-SIG-Finance mailing list, which would be in the results of a search on www.rseek.org.


6

The issue for any technique is, does it consistently work as expected in the future? If not, then it's worthless. The idea behind mean reversion is that you have a "mean" that means something (it's not arbitrary), and a deviation from that mean that reverts in some consistent way. A pair trade is a common form of a "mean reversion" trade. Below is a ...


6

I think of mean reversion as more of a single stock phenomenon. In aggregate, these ididosyncratic mean reversions should offset one another and make the market smoother than its component stocks. There is a lot of work on mean reversion at the single stock level. The best entry is Jegadeesh's 1990 paper on what became known as "short run reversal" -- the ...


5

The OU process is: http://en.wikipedia.org/wiki/Ornstein-Uhlenbeck_process Here's an example of the use of the OU method. http://epchan.blogspot.com/2007/01/what-is-your-stop-loss-strategy.html To me, the problem is identifying processes that actually have a reason to bleed down to the mean, and that show statistically significant results. If you can ...


4

The code of Euler Maruyama simulation method is pretty simple (nu is long run mean, lambda is mean reversion speed): ornstein_uhlenbeck <- function(T,n,nu,lambda,sigma,x0){ dw <- rnorm(n, 0, sqrt(T/n)) dt <- T/n x <- c(x0) for (i in 2:(n+1)) { x[i] <- x[i-1] + lambda*(nu-x[i-1])*dt + sigma*dw[i-1] } return(x); }


3

You can also use the Sim.DiffProc package. Have a look at this document: Sim.DiffProc: A Package for Simulation of Diffusion Processes in R See esp. chapter 2.1.2 There is even a Graphical User Interface (GUI) available for some functions: http://cran.r-project.org/web/packages/Sim.DiffProcGUI/index.html See chapter 4 in the above document for details.



Only top voted, non community-wiki answers of a minimum length are eligible