Just another thought:

If you google around, you may stumble upon some results on first passage
times for the OU-process that may be useful to you. These are known in an
closed-form solution.

I think, like Paul, that polishing the strategy is essential. Finding
reverting pairs are the easy part, but optimizing the entry/exit signals are
the trick.

Bjørn

PS: A simple code for calibrating the OU-process. Should've attached this
the first time :)

#source("ouFit.R")
ouFit=function(spread) {
  n=length(spread)
  x=spread[1:(n-1)]
  y=spread[2:n]
  spread.fit=lm(y~x)
  coefs=as.numeric(coefficients(spread.fit))
  a=coefs[1]
  b=coefs[2]
  err=var(residuals(spread.fit))

  alpha=-log(a)
  mu=alpha*b/(1-a)
  sigma=sqrt(2*alpha*err/(1-a^2))
  theta=list(alpha=alpha, mu=mu, sigma=sigma)
  return(theta)
}

It won't give you half-life, but you can use the alpha from the above code
to find it, in combination with my previous post.


2010/10/12 Paul Teetor <paulteetor@yahoo.com>

> Stephen:
>
> I do mean-reversion trading, and I use a half-life analysis to judge the
> wisdom of a trade. If the estimated half-life is too long, it doesn't make
> sense to take the trade. It's a time-vs-risk thing.
>
> In the past, I used the log(2)/speed formula mentioned by Bjorn, below.
> (His
> link is very useful, BTW.) However, I was very unhappy with the estimates
> provided by that formula. They did not match my actual trading experience.
>
> I did some research on the topic, and got some useful results. I added a
> momentum term to my model, measuruing the current slope of the spread. The
> slope answers an important question: is the spread currently reverting
> (moving towards the mean) or is it averting (moving away from the mean)?
> The
> half-life is different, depending upon the current phase (reversion vs.
> aversion). I found this conditioning term was statistically significant, so
> I condition my estimate on it. I generate historical data and partition it
> according to the market's reversion/aversion state. The two partitions
> shows
> a different half-life, with the reverting phase having a (much) shorter
> half-life than the averting phase. Both phases show an exponentally
> distributed half-life, but with different means. I use those historical
> estimates now in my trading, instead of the O-U estimate.
>
> In retrospect, the problem with the O-U model is that it assumes the
> mean-reverting process is always reverting. That is not quite correct. In
> my
> experience, the spreads can alternate between periods of mean-aversion and
> mean-reversion.
>
> I hope that helps (and I hope it makes sense!).
>
> Paul
>
>
> -----Original Message-----
> From: r-sig-finance-bounces@stat.math.ethz.ch
> [mailto:r-sig-finance-bounces@stat.math.ethz.ch] On Behalf Of Bjorn
> Skogtro
> Sent: Tuesday, October 12, 2010 5:34 AM
> To: r-sig-finance@stat.math.ethz.ch
> Subject: Re: [R-SIG-Finance] Ornstein-Uhlenbeck
>
> Hi Stephen,
>
> You could take a look at
>
> http://sitmo.com/doc/Calibrating_the_Ornstein-Uhlenbeck_model
>
> for the linear regression method, or take a look at the package "sde" which
> contains some examples using GMM (not for the Ornstein-Uhlenbeck process,
> though, only the CIR).
>
> The half-life is given as log(2)/mean-reversion speed.
>
> Do keep an eye on the partition of the time-axis, e.g. what frequency you
> are using (daily, yearly) for interpreting the half-life.
>
> BR,
> Bjxrn
>
>
>
>
>
>
> > ------------------------------
> >
> > Message: 2
> > Date: Tue, 12 Oct 2010 05:43:32 -0400
> > From: Sarbo <cmdr_rogue@hotmail.com>
> > To: r-sig-finance@stat.math.ethz.ch
> > Subject: Re: [R-SIG-Finance] Ornstein-Uhlenbeck
> > Message-ID: <BLU0-SMTP21220AA5FD288F890EED317E2540@phx.gbl>
> > Content-Type: text/plain; charset="utf-8"
> >
> > By half-life, do you mean the speed of mean-reversion?
> >
> > If so, there's a bit of algebraic tomfoolery that's required to
> > discretise the equation and then fit the data to it. I don't have the
> > time right now to go into all the details but it's not hard- you can
> > parameterise the process using simple linear regression. If you need
> > help with that I'll try and get back to you tonight about it.
> >
> > On Tue, 2010-10-12 at 13:47 +1100, Stephen Choularton wrote:
> >
> > > Hi
> > >
> > > Wonder if anyone could point me how I use this method to discover
> > > the half life of a mean reverting process.
> > >
> > > I am looking into pair trading and the time it takes for a
> > > cointegrated pair to revert to the norm.
> > >
> > > --
> > > Stephen Choularton Ph.D., FIoD
> > >
> > > 9999 2226
> > > 0413 545 182
> > >
> > >
> > > for insurance go to www.netinsure.com.au for markets go to
> > > www.organicfoodmarkets.com.au
> > >
> > >
> > > _______________________________________________
> > > R-SIG-Finance@stat.math.ethz.ch mailing list
> > > https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> > > -- Subscriber-posting only. If you want to post, subscribe first.
> > > -- Also note that this is not the r-help list where general R
> > > questions
> > should go.
> >
> >
> > -------------- next part -------------- An HTML attachment was
> > scrubbed...
> > URL: <
> > https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20101012/26e3
> > 2fc7/attachment-0001.html
> > >
> > -------------- next part -------------- A non-text attachment was
> > scrubbed...
> > Name: CoS2010Winner.JPG
> > Type: image/jpeg
> > Size: 16091 bytes
> > Desc: not available
> > URL: <
> > https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20101012/26e3
> > 2fc7/attachment-0001.jpe
> > >
> >
> > ------------------------------
> >
> > _______________________________________________
> > R-SIG-Finance mailing list
> > R-SIG-Finance@stat.math.ethz.ch
> > https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> >
> >
> > End of R-SIG-Finance Digest, Vol 77, Issue 8
> > ********************************************
>
>         [[alternative HTML version deleted]]
>
>
>


-- 
Up, down, turn around
Please dont let me hit the ground
Tonight I think Ill walk alone
Ill find my soul as I go home.

	[[alternative HTML version deleted]]

