NDK_CHOWTEST

 int __stdcall NDK_CHOWTEST ( double ** XX1, size_t M, double * Y1, size_t N1, double ** XX2, double * Y2, size_t N2, LPBYTE mask, size_t nMaskLen, double intercept, TEST_RETURN retType, double * retVal )

Returns the p-value of the regression stability test (i.e. whether the coefficients in two linear regressions on different data sets are equal).

Returns
status code of the operation
Return values
 NDK_SUCCESS Operation successful NDK_FAILED Operation unsuccessful. See Macros for full list.
Parameters
[in] XX1 is the independent variables data matrix of the first data set (two dimensional).
[in] M is the number of variables (columns) in XX1 and XX2.
[in] Y1 is the response or the dependent variable data array for the first data set (one dimensional array).
[in] N1 is the number of observations (rows) in the first data set.
[in] XX2 is the independent variables data matrix of the second data set, such that each column represents one variable.
[in] Y2 is the response or the dependent variable data array of the second data set (one dimensional array).
[in] N2 is the number of observations (rows) in the second data set.
[in] mask is the boolean array to select a subset of the input variables in X. If NULL, all variables in X are included.
[in] nMaskLen  is the number of elements in the mask, which must be zero or equal to M.
[in] intercept  is the regression constant or the intercept value (e.g. zero). If missing, an intercept is not fixed and will be computed from the data set.
[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.
[in] retVal  is the calculated Chow test statistics.
Remarks
• The data sets may include missing values.
• Each column in the explanatory (predictor) matrix corresponds to a separate variable.
• Each row in the explanatory matrix and corresponding dependent vector correspond to one observation.
• Observations (i.e. row) with missing values in X or Y are removed.
• Number of observation of each data set must be larger than the number of explanatory variables.
• In principle, the Chow test constructs the following regression models:
• Model 1 (Data set 1): $y_t = \alpha_1 + \beta_{1,1}\times X_1 + \beta_{2,1}\times X_2 + \cdots + \epsilon$
• Model 2 (Data set 2): $y_t = \alpha_2 + \beta_{1,2}\times X_1 + \beta_{2,2}\times X_2+ \cdots + \epsilon$
• Model 3 (Data sets 1 + 2): $y_t = \alpha + \beta_1\times X_1 + \beta_2 \times X_2 + \cdots + \epsilon$
• The Chow test hypothesis:

$H_{o}= \left\{\begin{matrix} \alpha_1 = \alpha_2 = \alpha \\ \beta_{1,1} = \beta_{1,2} = \beta_1 \\ \beta_{2,1} = \beta_{2,2} = \beta_2 \end{matrix}\right.$ $$H_{1}: \exists \alpha_i \neq \alpha, \exists \beta_{i,j} \neq \beta_i$$
Where:
• $$H_{o}$$ is the null hypothesis.
• $$H_{1}$$ is the alternate hypothesis.
• $$\beta_{i,j}$$ is the i-th coefficient in the j-th regression model (j=1,2,3).
• The Chow statistics are defined as follows: $\frac{(\mathrm{SSE}_C -(\mathrm{SSE}_1+\mathrm{SSE}_2))/(k)}{(\mathrm{SSE}_1+\mathrm{SSE}_2)/(N_1+N_2-2k)}$ Where:
• $$\mathrm{SSE}$$ is the sum of the squared residuals.
• $$K$$ is the number of explanatory variables.
• $$N_1$$ is the number of non-missing observations in the first data set.
• $$N_2$$ is the number of non-missing observations in the second data set.
• The Chow test statistics follow an F-distribution with $$k$$, and $$N_1+N_2-2\times K$$ degrees of freedom.
Requirements
Examples



 Namespace: NumXLAPI Class: SFSDK Scope: Public Lifetime: Static
 int NDK_CHOWTEST ( ref UIntPtr XX1, UIntPtr M, double[] Y1, UIntPtr N1, ref UIntPtr XX2, double[] Y2, UIntPtr N2, Byte[] mask, UIntPtr nMaskLen, double intercept, TEST_RETURN retType, ref double retVal )

Returns the p-value of the regression stability test (i.e. whether the coefficients in two linear regressions on different data sets are equal).

Returns
status code of the operation
Return values
 NDK_SUCCESS Operation successful NDK_FAILED Operation unsuccessful. See Macros for full list.
Parameters
[in] XX1 is the independent variables data matrix of the first data set (two dimensional).
[in] M is the number of variables (columns) in XX1 and XX2.
[in] Y1 is the response or the dependent variable data array for the first data set (one dimensional array).
[in] N1 is the number of observations (rows) in the first data set.
[in] XX2 is the independent variables data matrix of the second data set, such that each column represents one variable.
[in] Y2 is the response or the dependent variable data array of the second data set (one dimensional array).
[in] N2 is the number of observations (rows) in the second data set.
[in] mask is the boolean array to select a subset of the input variables in X. If NULL, all variables in X are included.
[in] nMaskLen  is the number of elements in the mask, which must be zero or equal to M.
[in] intercept  is the regression constant or the intercept value (e.g. zero). If missing, an intercept is not fixed and will be computed from the data set.
[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.
[in] retVal  is the calculated Chow test statistics.
Remarks
• The data sets may include missing values.
• Each column in the explanatory (predictor) matrix corresponds to a separate variable.
• Each row in the explanatory matrix and corresponding dependent vector correspond to one observation.
• Observations (i.e. row) with missing values in X or Y are removed.
• Number of observation of each data set must be larger than the number of explanatory variables.
• In principle, the Chow test constructs the following regression models:
• Model 1 (Data set 1): $y_t = \alpha_1 + \beta_{1,1}\times X_1 + \beta_{2,1}\times X_2 + \cdots + \epsilon$
• Model 2 (Data set 2): $y_t = \alpha_2 + \beta_{1,2}\times X_1 + \beta_{2,2}\times X_2+ \cdots + \epsilon$
• Model 3 (Data sets 1 + 2): $y_t = \alpha + \beta_1\times X_1 + \beta_2 \times X_2 + \cdots + \epsilon$
• The Chow test hypothesis:

$H_{o}= \left\{\begin{matrix} \alpha_1 = \alpha_2 = \alpha \\ \beta_{1,1} = \beta_{1,2} = \beta_1 \\ \beta_{2,1} = \beta_{2,2} = \beta_2 \end{matrix}\right.$ $$H_{1}: \exists \alpha_i \neq \alpha, \exists \beta_{i,j} \neq \beta_i$$
Where:
• $$H_{o}$$ is the null hypothesis.
• $$H_{1}$$ is the alternate hypothesis.
• $$\beta_{i,j}$$ is the i-th coefficient in the j-th regression model (j=1,2,3).
• The Chow statistics are defined as follows: $\frac{(\mathrm{SSE}_C -(\mathrm{SSE}_1+\mathrm{SSE}_2))/(k)}{(\mathrm{SSE}_1+\mathrm{SSE}_2)/(N_1+N_2-2k)}$ Where:
• $$\mathrm{SSE}$$ is the sum of the squared residuals.
• $$K$$ is the number of explanatory variables.
• $$N_1$$ is the number of non-missing observations in the first data set.
• $$N_2$$ is the number of non-missing observations in the second data set.
• The Chow test statistics follow an F-distribution with $$k$$, and $$N_1+N_2-2\times K$$ degrees of freedom.
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