[R-SIG-Finance] Mean reversion tests - with stationary tests and trending series

julius_cesarius maynaaze at yahoo.com
Wed Jun 30 19:13:21 CEST 2010


I'm having an issue using PP.test or adf.test as stationarity tests. I am
looking for the right tests to use to see if a series is mean reverting for
a pairs-trading like strategy.

Basically if the series is trending the tests still say the series is
stationary, but this would not be something I can use in pairs trading.

Short of writing code to detrend and test for trending - what would be
recommended for a test that a series is mean-reverting tradeable.

Example code to illustrate:

aSeries <- sin(seq(1,numElems)/pi)*5 
bSeries <- seq(1,numElems)
cSeries <- aSeries*10 + bSeries
dSeries <- cumsum(rnorm(numElems,sd=5))+200



staTest = function(inSeries) {
	ht <- adf.test(inSeries, alternative="stationary")
	cat("ADF p-value is", ht$p.value, "\n")
	ht$p.value
}

ssa <- staTest(aSeries)
ssb <- staTest(bSeries)
ssc <- staTest(cSeries)
ssd <- staTest(dSeries)
cat('STA test A=', ssa, 'B = ', ssb, 'C = ', ssc, 'D =', ssd, '\n')


// Results obtained:

STA test A= 0.01 B =  0.99 C =  0.01 D = 0.2764712 


Clearly A is the only series that should be stationary and the p test of
0.01 'confirms' this. However C is trending upwards and the P test is still
saying it's stationary.

I would appreciate any help.
-- 
View this message in context: http://r.789695.n4.nabble.com/Mean-reversion-tests-with-stationary-tests-and-trending-series-tp2272757p2272757.html
Sent from the Rmetrics mailing list archive at Nabble.com.



More information about the R-SIG-Finance mailing list