# NDK_NORMALTEST int __stdcall NDK_NORMALTEST ( double * X, size_t N, double alpha, WORD method, WORD retType, double * retVal )

Returns the p-value of the normality test (i.e. whether a data set is well-modeled by a normal distribution).

Returns
status code of the operation
Return values
 NDK_SUCCESS Operation successful NDK_FAILED Operation unsuccessful. See Macros for full list.
TEST_RETURN
Parameters
[in] X is the sample data (a one dimensional array).
[in] N is the number of observations in X.
[in] alpha is the statistical significance level. If missing, a default of 5% is assumed.
[in] method is the statistical test to perform (1=Jarque-Bera, 2=Shapiro-Wilk, 3=Chi-Square (Doornik and Hansen)).
[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
1. The sample data may include missing values (e.g. a time series as a result of a lag or difference operator).
2. The Jarque-Bera test is more powerful the higher the number of values.
3. The test hypothesis for the data is from a normal distribution: $H_{o}: x \sim N(.)$ $H_{1}: x \neq N(.)$ Where:
• $$H_{o}$$ is the null hypothesis.
• $$H_{1}$$ is the alternate hypothesis.
• $$N(.)$$ is the normal probability distribution function.
4. The Jarque-Bera test is a goodness-of-fit measure of departure from normality based on the sample kurtosis and skewness. The test is named after Carlos M. Jarque and Anil K. Bera. The test statistic JB is defined as: $\mathit{JB} = \frac{n}{6} \left( S^2 + \frac{K^2}{4} \right)$ Where:
• $$S$$ is the sample skewness.
• $$K$$ is the sample excess kurtosis.
• $$n$$ is the number of non-missing values in the data sample.
5. The Jarque-Bera $$\mathit{JB}$$ statistic has an asymptotic chi-square distribution with two degrees of freedom and can be used to test the null hypothesis that the data is from a normal distribution. $\mathit{JB} \sim \chi_{\nu=2}^2()$ Where:
• $$\chi_{\nu}^2()$$ is the Chi-square probability distribution function.
• $$\nu$$ is the degrees of freedom for the Chi-square distribution.
6. This is one-side (i.e. one-tail) test, so the computed p-value should be compared with the whole significance level ($$\alpha$$).
Requirements
Examples



 Namespace: NumXLAPI Class: SFSDK Scope: Public Lifetime: Static
 int NDK_NORMALTEST ( double[] pData, UIntPtr nSize, double alpha, UInt16 method, UInt16 retType, out double retVal )

Returns the p-value of the normality test (i.e. whether a data set is well-modeled by a normal distribution).

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 sample data (a one dimensional array).
[in] nSize is the number of observations in X.
[in] alpha is the statistical significance level. If missing, a default of 5% is assumed.
[in] method is the statistical test to perform (1=Jarque-Bera, 2=Shapiro-Wilk, 3=Chi-Square (Doornik and Hansen)).
[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
1. The sample data may include missing values (e.g. a time series as a result of a lag or difference operator).
2. The Jarque-Bera test is more powerful the higher the number of values.
3. The test hypothesis for the data is from a normal distribution: $H_{o}: x \sim N(.)$ $H_{1}: x \neq N(.)$ Where:
• $$H_{o}$$ is the null hypothesis.
• $$H_{1}$$ is the alternate hypothesis.
• $$N(.)$$ is the normal probability distribution function.
4. The Jarque-Bera test is a goodness-of-fit measure of departure from normality based on the sample kurtosis and skewness. The test is named after Carlos M. Jarque and Anil K. Bera. The test statistic JB is defined as: $\mathit{JB} = \frac{n}{6} \left( S^2 + \frac{K^2}{4} \right)$ Where:
• $$S$$ is the sample skewness.
• $$K$$ is the sample excess kurtosis.
• $$n$$ is the number of non-missing values in the data sample.
5. The Jarque-Bera $$\mathit{JB}$$ statistic has an asymptotic chi-square distribution with two degrees of freedom and can be used to test the null hypothesis that the data is from a normal distribution. $\mathit{JB} \sim \chi_{\nu=2}^2()$ Where:
• $$\chi_{\nu}^2()$$ is the Chi-square probability distribution function.
• $$\nu$$ is the degrees of freedom for the Chi-square distribution.
6. This is one-side (i.e. one-tail) test, so the computed p-value should be compared with the whole significance level ($$\alpha$$).
Exceptions
Exception Type Condition
None N/A
Requirements
Namespace NumXLAPI SFSDK Public Static NumXLAPI.DLL
Examples

References
* 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
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