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

hurst_spectrum Class Reference

Estimate the Hurst exponent using the wavelet transform. More...

#include <hurst_spectrum.h>

Inheritance diagram for hurst_spectrum::

hurst_base List of all members.

Public Methods

void calc_hurst_est (const double *v, const size_t N, hurstInfo &info)
 Estimate the Hurst exponent using the wavelet transform. More...


Private Methods

void spectrum_calc_ (const double *v, const size_t N, std::vector< double > &powerSpectrum)
 Calculate the wavelet power spectrum. More...


Detailed Description

Estimate the Hurst exponent using the wavelet transform.

Definition at line 11 of file hurst_spectrum.h.


Member Function Documentation

void hurst_spectrum::calc_hurst_est ( const double * v,
const size_t N,
hurstInfo & info ) [virtual]
 

Estimate the Hurst exponent using the wavelet transform.

The Wavelet method for estimating the Hurst exponent must, as far as I can tell, use an energy normalized version of the wavelet transform. The Daubechies transform is energy normalized but the classic version of the Haar wavelet is not (although the version used here is).

The wavelet transform is calculated for the data set for which the Hurst exponent is being estimated. The normalized power is calculated for each octave. In the code below the normalized power is calculated by first calculating the unnormalized power and then dividing by the number of wavelet coefficients in that octave (which will be 2j). This yields the power spectrum.

The log of the normalized power spectrum values is paired with the log of the size of the octave (e.g., j = log2(2j)), producing a set of points. A linear regression line is plotted through the points. The estimate for the Hurst exponent, H is

      H = abs( (slope-1) / 2 )

The power spectrum result is used from octave 3 (size = 8).

Reimplemented from hurst_base.

Definition at line 100 of file hurst_spectrum.cpp.

Referenced by wave_hurst::test().

00103 {
00104   vector<double> powerSpectrum;
00105 
00106   spectrum_calc_( v, N, powerSpectrum );
00107 
00108   const size_t numPts = powerSpectrum.size();
00109   size_t power = 8;
00110 
00111   (info.points()).clear();
00112   for (size_t octave = 3; octave < numPts; octave++) {
00113     double normPower = powerSpectrum[octave] / static_cast<double>(power);
00114     double logPower = log2( normPower );
00115     (info.points()).push_back( lregress::point( octave, logPower ) );
00116     power = power << 1;
00117   }
00118 
00119   // print_regression_points( info.points() );
00120   // printf("\n\n");
00121 
00122   lregress lr;
00123 
00124   lregress::lineInfo lineInfo;
00125   lr.lr( info.points(), lineInfo );
00126 
00127   double slope = lineInfo.slope();
00128   double intercept = lineInfo.intercept();
00129   double slopeError = lineInfo.slopeErr();
00130 
00131   info.slope( slope );
00132   info.slopeErr( slopeError );
00133   info.intercept( intercept );
00134 } // hurst_calc

void hurst_spectrum::spectrum_calc_ ( const double * v,
const size_t N,
std::vector< double > & powerSpectrum ) [private]
 

Calculate the wavelet power spectrum.

The wavelet power spectrum is calculated from the result of the wavelet transform. The wavelet transform results in a set of "octaves" which with a power of two number of wavelet coefficients. The power for a given octave is the sum of the squares of the wavelet coefficients in each octave.

     Pi = 0;
     for (j = octave_start; j < octave_end; j++) {
        Pi = Pi + vj2
     }

Where Pi is the power for octave i

The octaves span the array index regions:

      region  size  octave (power)
       1..1     1      0
       2..3     2      1
       4..7     4      2
       8..15    8      3
       16..31  16      4
         etc...

Note that element zero (v0) is a low pass value, so it is not used.

Definition at line 47 of file hurst_spectrum.cpp.

Referenced by calc_hurst_est().

00050 {
00051   //
00052   // Normalized wavelets
00053   //
00054   haar<double *> w;
00055   // line_norm<double *> w;
00056   // Daubechies<double *> w;
00057 
00058   double *data = new double[ N ];
00059   for (size_t i = 0; i < N; i++)
00060     data[i] = v[i];
00061 
00062   w.forwardTrans( data, N );
00063 
00064   spectrum::spectralCalc( data, N, powerSpectrum );
00065   delete [] data;
00066 } // spectrum_calc


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