# NDK_SKEWTEST

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

Calculates the p-value of the statistical test for the population skew (i.e. 3rd moment).

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 sample data (a one dimensional array).
[in] N is the number of observations in X.
[in] alpha is the statistical significance level. If missing, the default of 5% is assumed.
[in] method is the statistical test to perform (1=parametric).
[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 data sample may include missing values (NaN).
2. The test hypothesis for the population distribution skewness: $H_{o}: S=0$ $H_{1}: S\neq 0$ Where:
• $$H_{o}$$ is the null hypothesis.
• $$H_{1}$$ is the alternate hypothesis.
• $$S$$ is the population skew.
3. For the case in which the underlying population distribution is normal, the sample skew also has a normal sampling distribution: $\hat S \sim N(0,\frac{6}{T})$ Where:
• $$\hat S$$ is the sample skew (i.e. 3rd moment).
• $$T$$ is the number of non-missing values in the data sample.
• $$N(.)$$ is the normal (i.e. Gaussian) probability distribution function.
4. The sample data skew is calculated as: $\hat S(x)= \frac{\sum_{t=1}^T(x_t-\bar x)^3}{(T-1)\times \hat \sigma^3}$ Where:
• $$\hat S$$ is the sample skew (i.e. 3rd moment)
• $$x_i$$ is the i-th non-missing value in the data sample.
• $$T$$ is the number of non-missing values in the data sample.
• $$\hat \sigma$$ is the data sample standard deviation.
5. In the case where the population skew is not zero, the mean is farther out than the median in the long tail. The underlying distribution is referred to as skewed, unbalanced, or lopsided.
6. The underlying population distribution is assumed normal (Gaussian).
7. 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_SKEWTEST ( double[] pData, UIntPtr nSize, double alpha, UInt16 argMethod, UInt16 retType, out double retVal )

Calculates the p-value of the statistical test for the population skew (i.e. 3rd moment).

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 pData.
[in] alpha is the statistical significance level. If missing, the default of 5% is assumed.
[in] argMethod is the statistical test to perform (1=parametric).
[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 data sample may include missing values (NaN).
2. The test hypothesis for the population distribution skewness: $H_{o}: S=0$ $H_{1}: S\neq 0$ Where:
• $$H_{o}$$ is the null hypothesis.
• $$H_{1}$$ is the alternate hypothesis.
• $$S$$ is the population skew.
3. For the case in which the underlying population distribution is normal, the sample skew also has a normal sampling distribution: $\hat S \sim N(0,\frac{6}{T})$ Where:
• $$\hat S$$ is the sample skew (i.e. 3rd moment).
• $$T$$ is the number of non-missing values in the data sample.
• $$N(.)$$ is the normal (i.e. Gaussian) probability distribution function.
4. The sample data skew is calculated as: $\hat S(x)= \frac{\sum_{t=1}^T(x_t-\bar x)^3}{(T-1)\times \hat \sigma^3}$ Where:
• $$\hat S$$ is the sample skew (i.e. 3rd moment)
• $$x_i$$ is the i-th non-missing value in the data sample.
• $$T$$ is the number of non-missing values in the data sample.
• $$\hat \sigma$$ is the data sample standard deviation.
5. In the case where the population skew is not zero, the mean is farther out than the median in the long tail. The underlying distribution is referred to as skewed, unbalanced, or lopsided.
6. The underlying population distribution is assumed normal (Gaussian).
7. 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
* 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