int __stdcall NDK_HURST_EXPONENT | ( | double * | X, |
size_t | N, | ||
double | alpha, | ||
WORD | retType, | ||
double * | retVal | ||
) |
Calculates the Hurst exponent (a measure of persistence or long memory) for time series.
- Returns
- status code of the operation
- Return values
-
NDK_SUCCESS Operation successful NDK_FAILED Operation unsuccessful. See SFMacros.h for more details.
- Parameters
-
[in] X is the input data sample (a one dimensional array). [in] N is the number of observations in X. [in] alpha is the statistical significance level (1%, 5%, 10%). If missing, a default of 5% is assumed. [in] retType is a number that determines the type of return value: 1 = Empirical Hurst exponent (R/S method) 2 = Anis-Lloyd/Peters corrected Hurst exponent 3 = Theoretical Hurst exponent 4 = Upper limit of the confidence interval 5 = Lower limit of the confidence interval [out] retVal is the calculated value of this function.
- Note
- NDK_FAILED.
- 2. The input data series may include missing values (NaN), but they will not be included in the calculations.
- 3. The Hurst exponent, \(h\), is defined in terms of the rescaled range as follows:
- \[E \left [ \frac{R(n)}{S(n)} \right ]=C_n^H \] \[n \to \infty \]
- 4. Where:
- \(\left [ \frac{R(n)}{S(n)} \right ]\) is the Rescaled Range.
- \(E \left [x \right ]\) is the expected value.
- \(n\) is the time of the last observation (e.g. it corresponds to \(X_n\) in the input time series data.)
- \(h\) is a constant. of
- 5. The Hurst exponent is a measure autocorrelation (persistence and long memory): -A value of \(0<H<0.5\) indicates a time series with negative autocorrelation (e.g. a decrease between values will probably be followed by another decrease). -A value of \(0.5<H<1\) indicates a time series with positive autocorrelation (e.g. an increase between values will probably be followed by another increase). -A value of \(H=0.5\) indicates a "true random walk," where it is equally likely that a decrease or an increase will follow from any particular value (e.g. the time series has no memory of previous values).
- 6. The Hurst exponent's namesake, Harold Edwin Hurst (1880-1978), was a British hydrologist who researched reservoir capacity along the Nile river.
- 7. The rescaled range is calculated for a time series, \(X=X_1,X_2,\dots, X_n\), as follows:
- Calculate the mean:
\(m=\dfrac{1}{n} \sum_{i=1}^{n} X_i\) - Create a mean adjusted series:
\(Y_t=X_{t}-m \) for \( t=1,2, \dots ,n\) - Calculate the cumulative deviate series Z:
\(Z_t= \sum_{i=1}^{t} Y_{i} \) for \( t=1,2, \dots ,n\) - Create a range series R:
\(R_t = max\left (Z_1, Z_2, \dots, Z_t \right )- min\left (Z_1, Z_2, \dots, Z_t \right ) \) for \( t=1,2, \dots, n\) - Create a standard deviation series R:
\(S_{t}= \sqrt{\dfrac{1}{t} \sum_{i=1}^{t}\left ( X_{i} - u \right )^{2}}\) for \( t=1,2, \dots ,n\) Where:
\(h\) is the mean for the time series values \(X_1,X_2, \dots, X_t\)
- Calculate the mean:
- 8. Calculate the rescaled range series (R/S):
\(\left ( R/S \right )_{t} = \frac{R_{t}}{S_{t}} \) for \( t=1,2, \dots, n\)
- Requirements
-
Header SFSDK.H Library SFSDK.LIB DLL SFSDK.DLL
- Examples
-
Namespace: | NumXLAPI |
Class: | SFSDK |
Scope: | Public |
Lifetime: | Static |
int NDK_HURST_EXPONENT | ( | double[] | pData, |
UIntPtr | nSize, | ||
double | alpha, | ||
short | retType, | ||
ref double | retVal | ||
) |
Calculates the Hurst exponent (a measure of persistence or long memory) for time series.
- Returns
- status code of the operation
- Return values
-
NDK_SUCCESS Operation successful NDK_FAILED Operation unsuccessful. See SFMacros.h for more details.
- Parameters
-
[in] pData is the input data sample (a one dimensional array). [in] nSize is the number of observations in pData. [in] alpha is the statistical significance level (1%, 5%, 10%). If missing, a default of 5% is assumed. [in] retType is a number that determines the type of return value: 1 = Empirical Hurst exponent (R/S method) 2 = Anis-Lloyd/Peters corrected Hurst exponent 3 = Theoretical Hurst exponent 4 = Upper limit of the confidence interval 5 = Lower limit of the confidence interval [out] retVal is the calculated value of this function.
- Remarks
- 1. The input data series may include missing values (NaN), but they will not be included in the calculations.
- 2. The Hurst exponent, \(h\), is defined in terms of the rescaled range as follows:
- \[E \left [ \frac{R(n)}{S(n)} \right ]=C_n^H \] \[n \to \infty \]
- 3. Where:
- \(\left [ \frac{R(n)}{S(n)} \right ]\) is the Rescaled Range.
- \(E \left [x \right ]\) is the expected value.
- \(n\) is the time of the last observation (e.g. it corresponds to \(X_n\) in the input time series data.)
- \(h\) is a constant. of
- 4. The Hurst exponent is a measure autocorrelation (persistence and long memory): -A value of \(0<H<0.5\) indicates a time series with negative autocorrelation (e.g. a decrease between values will probably be followed by another decrease). -A value of \(0.5<H<1\) indicates a time series with positive autocorrelation (e.g. an increase between values will probably be followed by another increase). -A value of \(H=0.5\) indicates a "true random walk," where it is equally likely that a decrease or an increase will follow from any particular value (e.g. the time series has no memory of previous values).
- 5. The Hurst exponent's namesake, Harold Edwin Hurst (1880-1978), was a British hydrologist who researched reservoir capacity along the Nile river.
- 6. The rescaled range is calculated for a time series, \(X=X_1,X_2,\dots, X_n\), as follows:
- Calculate the mean:
\(m=\dfrac{1}{n} \sum_{i=1}^{n} X_i\) - Create a mean adjusted series:
\(Y_t=X_{t}-m \) for \( t=1,2, \dots ,n\) - Calculate the cumulative deviate series Z:
\(Z_t= \sum_{i=1}^{t} Y_{i} \) for \( t=1,2, \dots ,n\) - Create a range series R:
\(R_t = max\left (Z_1, Z_2, \dots, Z_t \right )- min\left (Z_1, Z_2, \dots, Z_t \right ) \) for \( t=1,2, \dots, n\) - Create a standard deviation series R:
\(S_{t}= \sqrt{\dfrac{1}{t} \sum_{i=1}^{t}\left ( X_{i} - u \right )^{2}}\) for \( t=1,2, \dots ,n\) Where:
\(h\) is the mean for the time series values \(X_1,X_2, \dots, X_t\)
- Calculate the mean:
- 8. Calculate the rescaled range series (R/S):
\(\left ( R/S \right )_{t} = \frac{R_{t}}{S_{t}} \) for \( t=1,2, \dots, n\)
- Exceptions
-
Exception Type Condition None N/A
- Requirements
-
Namespace NumXLAPI Class SFSDK Scope Public Lifetime Static Package NumXLAPI.DLL
- Examples
-
- References
- [1] A.A.Anis, E.H.Lloyd (1976) The expected value of the adjusted rescaled Hurst range of independent normal summands, Biometrica 63, 283-298.
- [2] H.E.Hurst (1951) Long-term storage capacity of reservoirs, Transactions of the American Society of Civil Engineers 116, 770-808.
- [3] E.E.Peters (1994) Fractal Market Analysis, Wiley.
- [4] R.Weron (2002) Estimating long range dependence: finite sample properties and confidence intervals, Physica A 312, 285-299.