int __stdcall NDK_WNTEST | ( | double * | X, |
size_t | N, | ||
size_t | K, | ||
double | alpha, | ||
WORD | method, | ||
WORD | retType, | ||
double * | retVal | ||
) |
Computes the p-value of the statistical portmanteau test (i.e. whether any of a group of autocorrelations of a time series are different from zero).
- Returns
- status code of the operation
- Return values
-
NDK_SUCCESS Operation successful NDK_FAILED Operation unsuccessful. See Macros for full list.
- Parameters
-
[in] X is the univariate time series data (a one dimensional array). [in] N is the number of observations in X. [in] K is the lag order (e.g. k=0 (no lag), k=1 (1st lag), etc.). [in] alpha is the statistical significance level. If missing, a default of 5% is assumed. [in] method is the statistical test to perform (1=Ljung-Box). [in] retType is a switch to select the return output: Method Value Description TEST_PVALUE 1 P-Value TEST_SCORE 2 Test statistics (aka score) TEST_CRITICALVALUE 3 Critical value. [out] retVal is the calculated test statistics.
- Remarks
-
- The time series is homogeneous or equally spaced.
- The time series may include missing values (NaN) at either end.
- The test hypothesis for white-noise: \[H_{o}: \rho_{1}=\rho_{2}=...=\rho_{m}=0\] \[H_{1}: \exists \rho_{k}\neq 0\] \[1\leq k \leq m\] Where:
- \(H_{o}\) is the null hypothesis.
- \(H_{1}\) is the alternate hypothesis.
- \(\rho_k\) is the population autocorrelation function for lag k
- \(m\) is the maximum number of lags included in the white-noise test.
- The Ljung Box test modified \(Q^*(m)\) statistic is computed as: \[Q^* =T(T+2)\sum_{j=1}^{m}\frac{\hat\rho_{j}^2}{T-l}\] Where:
- \(m\) is the maximum number of lags included in the test.
- \(\hat\rho_j\) is the sample autocorrelation at lag j.
- \(T\) is the number of non-missing values in the data sample.
- The Ljung Box test modified \(Q^*\) statistic has an asymptotic chi-square distribution with \(m\) degrees of freedom and can be used to test the null hypothesis that the time series is not serially correlated. \[Q^*(m) \sim \chi_{\nu=m}^2()\] Where:
- \(\chi_{\nu}^2()\) is the Chi-square probability distribution function.
- \(\nu\) is the degrees of freedom for the Chi-square distribution.
- The Ljung Box test is a suitable test for all sample sizes including small ones.
- This is one-side (i.e. one-tail) test, so the computed p-value should be compared with the whole significance level ($\alpha$).
- In practice, the selection of \(m\) may affect the performance of the \(Q(m)\) statistic. Several values of m are often used. Simulation studies suggest that the choice of \(m\approx \ln(T)\) provides better power performance.
- Requirements
-
Header SFSDK.H Library SFSDK.LIB DLL SFSDK.DLL
- Examples
-
Namespace: | NumXLAPI |
Class: | SFSDK |
Scope: | Public |
Lifetime: | Static |
int NDK_WNTEST | ( | double[] | pData, |
UIntPtr | nSize, | ||
int | nLag, | ||
double | alpha, | ||
UInt16 | argMethod, | ||
UInt16 | retType, | ||
out double | retVal | ||
) |
Computes the p-value of the statistical portmanteau test (i.e. whether any of a group of autocorrelations of a time series are different from zero).
- Returns
- status code of the operation
- Return values
-
NDK_SUCCESS Operation successful NDK_FAILED Operation unsuccessful. See Macros for full list.
- Parameters
-
[in] pData is the univariate time series data (a one dimensional array). [in] nSize is the number of observations in pData. [in] nLag is the lag order (e.g. k=0 (no lag), k=1 (1st lag), etc.). [in] alpha is the statistical significance level. If missing, a default of 5% is assumed. [in] argMethod is the statistical test to perform (1=Ljung-Box). [in] retType is a switch to select the return output: Method Value Description TEST_PVALUE 1 P-Value TEST_SCORE 2 Test statistics (aka score) TEST_CRITICALVALUE 3 Critical value. [out] retVal is the calculated test statistics.
- Remarks
-
- The time series is homogeneous or equally spaced.
- The time series may include missing values (NaN) at either end.
- The test hypothesis for white-noise: \[H_{o}: \rho_{1}=\rho_{2}=...=\rho_{m}=0\] \[H_{1}: \exists \rho_{k}\neq 0\] \[1\leq k \leq m\] Where:
- \(H_{o}\) is the null hypothesis.
- \(H_{1}\) is the alternate hypothesis.
- \(\rho_k\) is the population autocorrelation function for lag k
- \(m\) is the maximum number of lags included in the white-noise test.
- The Ljung Box test modified \(Q^*(m)\) statistic is computed as: \[Q^* =T(T+2)\sum_{j=1}^{m}\frac{\hat\rho_{j}^2}{T-l}\] Where:
- \(m\) is the maximum number of lags included in the test.
- \(\hat\rho_j\) is the sample autocorrelation at lag j.
- \(T\) is the number of non-missing values in the data sample.
- The Ljung Box test modified \(Q^*\) statistic has an asymptotic chi-square distribution with \(m\) degrees of freedom and can be used to test the null hypothesis that the time series is not serially correlated. \[Q^*(m) \sim \chi_{\nu=m}^2()\] Where:
- \(\chi_{\nu}^2()\) is the Chi-square probability distribution function.
- \(\nu\) is the degrees of freedom for the Chi-square distribution.
- The Ljung Box test is a suitable test for all sample sizes including small ones.
- This is one-side (i.e. one-tail) test, so the computed p-value should be compared with the whole significance level ($\alpha$).
- In practice, the selection of \(m\) may affect the performance of the \(Q(m)\) statistic. Several values of m are often used. Simulation studies suggest that the choice of \(m\approx \ln(T)\) provides better power performance.
- 6. Special cases: By definition, \(\hat{\rho}(0) \equiv 1.0\)
- Exceptions
-
Exception Type Condition None N/A
- Requirements
-
Namespace NumXLAPI Class SFSDK Scope Public Lifetime Static Package NumXLAPI.DLL
- Examples
-
- References
- Hull, John C.; Options, Futures and Other DerivativesFinancial Times/ Prentice Hall (2011), ISBN 978-0132777421
- Hans-Peter Deutsch; , Derivatives and Internal Models, Palgrave Macmillan (2002), ISBN 0333977068
- John Y. Campbell, Andrew W. Lo, A. Craig MacKinlay, Andrew Y. Lo; The Econometrics of Financial Markets; Princeton University Press; 2nd edition(Dec 09, 1996), ISBN: 691043019
- * Hamilton, J .D.; Time Series Analysis , Princeton University Press (1994), ISBN 0-691-04289-6
- * Tsay, Ruey S.; Analysis of Financial Time Series John Wiley & SONS. (2005), ISBN 0-471-690740
- * D. S.G. Pollock; Handbook of Time Series Analysis, Signal Processing, and Dynamics; Academic Press; Har/Cdr edition(Nov 17, 1999), ISBN: 125609906
- * Box, Jenkins and Reisel; Time Series Analysis: Forecasting and Control; John Wiley & SONS.; 4th edition(Jun 30, 2008), ISBN: 470272848