Tag Info

Hot answers tagged


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.


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 ...


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 ...


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 ...


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); }


There are sufficiently different ways to calculate the Sharpe ratio that the best advice I can give is to do whatever your boss wants. Also, if it is for a paper or research document, just make clear you document your method. My approach is usually to calculate the highest frequency Sharpe ratio I can based on the data. The higher frequency choice is to get ...


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.


If you wanted to see the following (price $S_t$, log return $r$, simple return $R$) then $$ r = \log(S_{t+1}) - \log(S_t) = \log(S_{t+1}/S_{t}), $$ and $$ R = S_{t+1}/S_{t}-1, $$ thus $$ R = \exp(r)-1 $$ and $$r = \log(1+R).$$ Was this the question?


Here is an example calculation according to the formula by William F. Sharpe, 1994. The OP's method of annualising the variance (as used below), is also specified by the Committee of European Securities Regulators in this document, page 5, box 1. For this example, taking 24 months of returns of risk-free proxy (US 4-week T-bills) and an example stock, (and ...


This is tough but the below reference found a small edge with 3% R2 - mean reversion is more likely to happen in upward market while momentum is strong in downward market. http://www.alphaarchitect.com/blog/2014/07/15/timing-the-market-with-mean-reversion-indicators/

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