# NDK_ARCHTEST

 int __stdcall NDK_ARCHTEST ( double * X, size_t N, size_t K, double alpha, WORD method, WORD retType, double * retVal )

Calculates the p-value of the ARCH effect test (i.e. the white-noise test for the squared time series).

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 (e.g. NaN) at either end.
• The lag order (k) must be less than the time series size, or an error value (#VALUE!) is returned.
• The test hypothesis for the population autocorrelation:
$H_{o}: \rho_{k}=\rho_o$ $H_{1}: \rho_{k}\neq a$ Where:
• $$H_{o}$$ is the null hypothesis.
• $$H_{1}$$ is the alternate hypothesis.
• $$\hat \rho_o$$ is the assumed population autocorrelation function for lag k.
• $$k$$ is the lag order.
• Assuming a normal distributed population, the sample autocorrelation has a normal distribution: $\hat \rho_k \sim N(\rho_k,\sigma_{\rho_k}^2)$ Where:
• $$\hat \rho_k$$ is the sample autocorrelation for lag k.
• $$\rho_k$$ is the population autocorrelation for lag k.
• $$\sigma_{\rho_k}$$ is the standard deviation of the sample autocorrelation function for lag k.
• The variance of the sample autocorrelation is computed as: $\sigma_{\rho_k}^2 = \frac{1+\sum_{j=1}^{k-1}\hat\rho_j^2}{T}$ Where:
• $$\sigma_{\rho_k}$$ is the standard error of the sample autocorrelation for lag k.
• $$T$$ is the sample data size.
• $$\hat\rho_j$$ is the sample autocorrelation function for lag j.
• $$k$$ is the lag order.
• This is a two-sides (i.e. two-tails) test, so the computed p-value should be compared with half of the significance level ($$\alpha/2$$).
Requirements
Examples



 Namespace: NumXLAPI Class: SFSDK Scope: Public Lifetime: Static
 int NDK_ARCHTEST ( double[] pData, UInPtr nSize, int nLag, double alpha, UInt16 argMethod, UInt16 retType, out double retVal )

Calculates the p-value of the ARCH effect test (i.e. the white-noise test for the squared time series).

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 (e.g. NaN) at either end.
• The lag order (k) must be less than the time series size, or an error value (#VALUE!) is returned.
• The test hypothesis for the population autocorrelation:
$H_{o}: \rho_{k}=\rho_o$ $H_{1}: \rho_{k}\neq a$ Where:
• $$H_{o}$$ is the null hypothesis.
• $$H_{1}$$ is the alternate hypothesis.
• $$\hat \rho_o$$ is the assumed population autocorrelation function for lag k.
• $$k$$ is the lag order.
• Assuming a normal distributed population, the sample autocorrelation has a normal distribution: $\hat \rho_k \sim N(\rho_k,\sigma_{\rho_k}^2)$ Where:
• $$\hat \rho_k$$ is the sample autocorrelation for lag k.
• $$\rho_k$$ is the population autocorrelation for lag k.
• $$\sigma_{\rho_k}$$ is the standard deviation of the sample autocorrelation function for lag k.
• The variance of the sample autocorrelation is computed as: $\sigma_{\rho_k}^2 = \frac{1+\sum_{j=1}^{k-1}\hat\rho_j^2}{T}$ Where:
• $$\sigma_{\rho_k}$$ is the standard error of the sample autocorrelation for lag k.
• $$T$$ is the sample data size.
• $$\hat\rho_j$$ is the sample autocorrelation function for lag j.
• $$k$$ is the lag order.
• This is a two-sides (i.e. two-tails) test, so the computed p-value should be compared with half of the significance level ($$\alpha/2$$).
Exceptions
Exception Type Condition
None N/A
Requirements
Namespace NumXLAPI SFSDK Public Static 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