# NDK_MEANTEST

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

Calculates the p-value of the statistical test for the population mean.

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] target  is the assumed mean value. If missing, a default of zero is assumed.
[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 sample data may include missing values (NaN).
2. The test hypothesis for the population mean: $H_{o}: \mu=\mu_o$ $H_{1}: \mu\neq \mu_o$ Where:
• $$H_{o}$$ is the null hypothesis.
• $$H_{1}$$ is the alternate hypothesis.
• $$\mu_o$$ is the assumed population mean.
• $$\mu$$ is the actual population mean.
3. For the case in which the underlying population distribution is normal, the sample mean/average has a Student's t with T-1 degrees of freedom sampling distribution: $\bar x \sim t_{\nu=T-1}(\mu,\frac{S^2}{T})$ Where:
• $$\bar x$$ is the sample average.
• $$\mu$$ is the population mean/average.
• $$S$$ is the sample standard deviation. $S^2 = \frac{\sum_{i=1}^T(x_i-\bar x)^2}{T-1}$
• $$T$$ is the number of non-missing values in the data sample.
• $$t_{\nu}()$$ is the Student's t-Distribution.
• $$\nu$$ is the degrees of freedom of the Student's t-Distribution.
4. The Student's t-Test for the population mean can be used for small and for large data samples.
5. This is a two-sides (i.e. two-tails) test, so the computed p-value should be compared with half of the significance level ($$\frac{\alpha}{2}$$).
6. The underlying population distribution is assumed normal (Gaussian).
Requirements
Examples



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

Calculates the p-value of the statistical test for the population mean.

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] target  is the assumed mean value. If missing, a default of zero is assumed.
[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 sample data may include missing values (NaN).
2. The test hypothesis for the population mean: $H_{o}: \mu=\mu_o$ $H_{1}: \mu\neq \mu_o$ Where:
• $$H_{o}$$ is the null hypothesis.
• $$H_{1}$$ is the alternate hypothesis.
• $$\mu_o$$ is the assumed population mean.
• $$\mu$$ is the actual population mean.
3. For the case in which the underlying population distribution is normal, the sample mean/average has a Student's t with T-1 degrees of freedom sampling distribution: $\bar x \sim t_{\nu=T-1}(\mu,\frac{S^2}{T})$ Where:
• $$\bar x$$ is the sample average.
• $$\mu$$ is the population mean/average.
• $$S$$ is the sample standard deviation. $S^2 = \frac{\sum_{i=1}^T(x_i-\bar x)^2}{T-1}$
• $$T$$ is the number of non-missing values in the data sample.
• $$t_{\nu}()$$ is the Student's t-Distribution.
• $$\nu$$ is the degrees of freedom of the Student's t-Distribution.
4. The Student's t-Test for the population mean can be used for small and for large data samples.
5. This is a two-sides (i.e. two-tails) test, so the computed p-value should be compared with half of the significance level ($$\frac{\alpha}{2}$$).
6. The underlying population distribution is assumed normal (Gaussian).
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