# Tag Info

8

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

6

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

6

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

4

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?

4

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

3

You can see fairly quickly that an exact answer to this question is not going to be feasible because your functional transformation is to take the square root of $\sigma_t^2$, and the square root function has a countably infinite number of derivatives. This implies that a Taylor expansion is going to leave us with a countably infinite number of terms, most ...

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.

2

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

2

In literature you'll find many approaches to compute the variance. As mentioned already, the standard ideas are to use MLE, Shrinkage on the Covariance Matrix (Ledoit, Wolf), Shrinkage on the inverse of the Covariance Matrix (Kourtis,Dotsis) which makes sense as in fact the inverse of the Covariance Matrix determines the shape of the efficient frontier. ...

1

When calculating the simple arithmetic mean, each observation has an equal weight: $$\hat \mu^{simple} = \frac{1}{T}\sum_{t=1}^T x_t.$$ If the observations are $i.i.d.$, $\hat \mu^{simple}$ is an efficient estimator of the population mean. When estimating the mean of a GARCH process, $\hat \mu^{simple}$ is no longer efficient. It makes sense to ...

1

The code is correct regarding your question (and only for an AR(1) ), you made a mistake because the last observation of the data set is $t-1$ and not $t$ since you are forecasting the point at time $t$. In the code : MF(i,1) is the current point forecast ($t$) and lag one observation ( MF(i-1,1) which is $t-1$ ) is correctly related to the AR part. ...

1

This is why Markowitz says that the diversification of the portfolio is always preferable. You have a lot of certain past data and some fallible speculations to evaluate the variance and expected return of a title. Inherently the best possible evaluation method, and there are several main ones, is not a foolproof inference. But, if you diversify your ...

1

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