Quantifying randomness: variance ratio

Quote from mysticman:

Would it be possible for those of us with Excel to do this test? I believe the VR is also called an F-test. Would you suggest a stock so that we could post the results and compare with yours?

Use something like this in the vba editor...

Sub VR_Profile()
Dim a(1000) 'close data
Dim v(30) 'vr profile data
For i = 1 To 1000
a(i) = Cells(i + 1, 1)
Next i
For j = 1 To 30
ct = 0
For i = j To 999 Step j
v(j) = v(j) + (Log(a(i + 1) / a(i + 1 - j))) ^ 2
ct = ct + 1
Next i
v(j) = v(j) / ct
Next j
For j = 1 To 30
Cells(j + 1, 6) = v(j) / j
Next j
End Sub

A quick example follows. Looks ok by I haven't test it extensively. The only thing missing is a smoothing line for the scatter data.

Regards
 

Attachments

VR profiles look pretty interesting. If I have a sample size of 10000 should the following code from gbos' post work properly (interms of size of larger array to that of smaller array)?>

Sub VR_Profile()
Dim a(10000) 'close data
Dim v(300) 'vr profile data
For i = 1 To 10000
a(i) = Cells(i + 1, 1)
Next i
For j = 1 To 300
ct = 0
For i = j To 10000 Step j
v(j) = v(j) + (Log(a(i + 1) / a(i + 1 - j))) ^ 2
ct = ct + 1
Next i
v(j) = v(j) / ct
Next j
For j = 1 To 300
Cells(j + 1, 6) = v(j) / j
Next j
End Sub

Thanks!
 
Oh shit, I must have been retarded from sleep deprivation. The bias is still there, but it is not only 10 samples because it uses overlapping returns, but the same principle applies.

100:1 means the ratio of 100-period changes to 1-period changes.

To calculate the 100 period changes you must sum the changes for 100 periods.. move forward 1 period.. sum the 100 period changes again (so your window now contains 99 samples from the last window and 1 from the new one).

Quote from mysticman:

So let's say we have 4 years of data (1000 days). The max length of the VR period would be 33 days? That's a long way from the length of the series. And the minimum length?
Why only 10 samples? Is that 1000 random walk length / 100?
I'm not sure what the 100:1 ratio means. Does it mean 100 sample length and 1 VR period?
So if you have 100 days you use only a 1 day period? How can that be?
 
GTG, I don't understand why "trading time" would not be "real-time"? To your point about using tick data, I agree with you that you could take a certain number of ticks as your base period, if not 10 then perhaps 500 or somewhere

What I meant was this. I've only been looking at high frequency data for a little while, and I've been going back and forth on what type of datastream to use for my investigations.

For example, If I'm looking at the last trade price, one way is to treat it simply as a sequence of numbers "as is", and then say compute a statistic on the last 30 prices that printed on the tape as trades. This is what I meant by trading time, because the time frame for the computed statistic is independent of actual real world time. In the morning a stock might do 30 prints in a minute, and at lunch it might take 5 minutes or so. So, the computed statistic will be for a variable length of time depending on how fast the instrument is trading.

The other way is to organize the data over time in some way like for example sampling the price once every minute, or taking an average price over a period of a minute. Then do a calculation on say the last 30 samples. If the sampling period is 1 minute, then the statistic computed over 30 samples will always be for the last 30 minutes.
 
This is actually a common idea, get the book "Introduction to High-Frequency Finance" from Olsen.

http://www.olsen.ch/research/approach.html

The Business Time Scale

To allow for this seasonality when analyzing intra-day data, Olsen has developed a model of time in which data from periods when there are fewer traders present in the market is compressed, and data from active periods is expanded. For example, the Asian lunch hour is contracted and the afternoon period, when both the European and New York markets are open, is expanded. This "business time scale" ensures that the behavior of the market at any particular moment is interpreted in the context of the number of participants present.

Apart from the daily and weekly seasonality, Olsen applies business time in a more general way. During any period of high activity, the scale at which the activity is measured is made more fine so that the full detail of the market dynamics is captured. The opposite applies during periods of low activity.

The presence in the markets of a scaling law and seasonality leads to the possibility of forecasting. The fractal nature of the market means that short-term volatility - for example, over one hour-can be predicted by longer-term volatility-such as over one day. But why are there fractal patterns in the markets? Classical theory has no explanation. Olsen believes the answer lies in the differences between market participants, a factor that classical theory does not address.



Quote from GTG:

What I meant was this. I've only been looking at high frequency data for a little while, and I've been going back and forth on what type of datastream to use for my investigations.

For example, If I'm looking at the last trade price, one way is to treat it simply as a sequence of numbers "as is", and then say compute a statistic on the last 30 prices that printed on the tape as trades. This is what I meant by trading time, because the time frame for the computed statistic is independent of actual real world time. In the morning a stock might do 30 prints in a minute, and at lunch it might take 5 minutes or so. So, the computed statistic will be for a variable length of time depending on how fast the instrument is trading.

The other way is to organize the data over time in some way like for example sampling the price once every minute, or taking an average price over a period of a minute. Then do a calculation on say the last 30 samples. If the sampling period is 1 minute, then the statistic computed over 30 samples will always be for the last 30 minutes.
 
There is also another measure which can be used, fit an ARMA(1,1) model to the data and then check the coeffcient of the parameter.

if it is mean reverting the impulse response will slope down, if is trending it will slope upwards.

If it is mean reverting the half-life of deviations from the mean can be calculated as: log(0.5)/log(-p)

I generated 10 random walks, and then 10 more with drift (half up half down)

moreRandomWalks.png


Here is the impulse responses for the random walks.

ARMA1,1RandomWalkImpulseResponses.png


Now here are the impulse responses for the random walks w/ drift.

ARMA1,1RandomWalkDriftImpulseResponses.png


Note that the impulse slopes upwards regardless of the trend direction.
 
Quote from stephencrowley:

This is actually a common idea, get the book "Introduction to High-Frequency Finance" from Olsen.
The Business Time Scale
Hi stephen,

some good work on this thread for a change - as many of us (myself included) mainly come to ET for the mirth and comedy - and to expose any potential snake-oilers, I'm starting to wonder if this is ET on some bizarro parallel universe! :D

There is a paper on Olsen's site discussing the concepts of business and intrinsic time - of course their background is spot FX, as there is no "real" tick or volume data on the total interbank market so to speak.

Link to paper...
http://www.olsen.ch/research/302_realTimeEconometr10.93.pdf

EQ
 
Quote from Equalizer:


some good work on this thread for a change - as many of us (myself included) mainly come to ET for the mirth and comedy - and to expose any potential snake-oilers, I'm starting to wonder if this is ET on some bizarro parallel universe! :D

And don't forget the charts made in matlab....and not with one of these numerous poor charting software...
 
Thanks for the kind words Equalizer :) ET is definately comical most of the time.. maybe the geeky words in the thread title scared off the trolls.

I must admit that Olsen's concept of intrinsic time is a little odd.. especially that there isn't a straightforward way to extend it to multiple variables.

Quote from Equalizer:

Hi stephen,

some good work on this thread for a change - as many of us (myself included) mainly come to ET for the mirth and comedy - and to expose any potential snake-oilers, I'm starting to wonder if this is ET on some bizarro parallel universe! :D

There is a paper on Olsen's site discussing the concepts of business and intrinsic time - of course their background is spot FX, as there is no "real" tick or volume data on the total interbank market so to speak.

Link to paper...
http://www.olsen.ch/research/302_realTimeEconometr10.93.pdf

EQ
 
Back
Top