Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

wave_hurst Class Reference

Test class for running the wavelet Hurst estimator on a range of n-day returns. More...

#include <wave_hurst.h>

Inheritance diagram for wave_hurst::

hurst_test_base List of all members.

Public Methods

 wave_hurst (const char *path)
 ~wave_hurst ()
void test ()
 Run the wavelet Hurst exponent estimation algorithm against a range of returns. More...


Private Methods

 wave_hurst (const wave_hurst &rhs)

Detailed Description

Test class for running the wavelet Hurst estimator on a range of n-day returns.

Definition at line 11 of file wave_hurst.h.


Constructor & Destructor Documentation

wave_hurst::wave_hurst ( const wave_hurst & rhs ) [private]
 

wave_hurst::wave_hurst ( const char * path ) [inline]
 

Definition at line 17 of file wave_hurst.h.

00017 : hurst_test_base( path ) {}

wave_hurst::~wave_hurst ( ) [inline]
 

Definition at line 18 of file wave_hurst.h.

00018 {}


Member Function Documentation

void wave_hurst::test ( ) [virtual]
 

Run the wavelet Hurst exponent estimation algorithm against a range of returns.

For comparision the rescaled range is also run. Note that the rescaled range algorithm does not necessarily require data with a power of two number of elements. However, wavelet algorithms are limited to a power of two data set.

This class mirrors the hurst_stocks class (they are both derived from the same base class).

   1-day return  8192 values
   2-day return  4096 values
   4-day return  2048 values
   8-day return  1024 values
  16-day return   512 values
  32-day return   256 values

Reimplemented from hurst_test_base.

Definition at line 30 of file wave_hurst.cpp.

Referenced by main().

00031 {
00032   const size_t ReturnSize = 8192;
00033   const size_t DataSize = 8193;
00034 
00035   // These arrays have to be static to get around some Microsoft
00036   // wierdness with large stack allocated arrays.
00037   static double data[ DataSize ];
00038   static double returns[ ReturnSize ];
00039 
00040   //  for (size_t tableEntry = 0; tableEntry < tableSize_; tableEntry++) {
00041   //  const char *fileName = equityTable_[tableEntry].file();
00042     const char *fileName = "ibm_30year.csv";
00043     size_t n = DataSize;
00044     if (ts.getTS( fileName, data, n, yahooTS::Close )) {
00045       assert(n == DataSize );
00046 
00047       hurst_spectrum::hurstInfo waveInfo;
00048       hurst_spectrum wave;
00049 
00050       rescaled_range rs;
00051       rescaled_range::hurstInfo RSInfo;
00052 
00053       for (size_t blockSize = 1; blockSize <= 32; blockSize = (blockSize << 1)) {
00054         for (size_t i = 0; i < ReturnSize; i++)
00055           returns[i] = 0;
00056 
00057         size_t numReturns;
00058         numReturns = blockedLogReturn( data, returns, DataSize, blockSize );
00059 
00060         wave.calc_hurst_est( returns, numReturns, waveInfo );
00061         rs.calc_hurst_est( returns, numReturns, RSInfo );
00062 
00063         double H = fabs( (waveInfo.slope() - 1)/ 2 );
00064 
00075         printf("%2d %7.4f\n", blockSize, RSInfo.slope() );
00076       }
00077 
00085   } // for
00086 }


The documentation for this class was generated from the following files:
Generated at Thu May 22 21:12:35 2003 for Hurst Exponent Calculation and Supporting Statistics by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001