NDK_JOHANSENTEST

int __stdcall NDK_JOHANSENTEST(double ** XX,


size_t N,


size_t M,


size_t K,


short nPolyOrder,


BOOL tracetest,


WORD R,


double alpha,


double * retStat,


double * retCV 

)

Returns the Johansen (cointegration) test statistics for two or more 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]XXis the multivariate time series matrix data (two dimensional).
[in]Nis the number of observations in XX.
[in]Mis the number of variables in XX.
[in]Kis the number of lagged difference terms used when computing the estimator.
[in]nPolyOrderis the order of the polynomial: (-1=no constant, 0=contant-only (default), 1=constant and trend).
[in]tracetestis a flag to select test: TRUE=trace, FALSE=maximal eignvalue test.
[in]Ris the assumed number of cointegrating relationships between the variables (if missing, r=1).
[in]alphais the statistical significance level. If missing, a default of 5% is assumed.
[out]retStatis the calculated test statistics score.
[out]retCVis the calculated test critical value.
Remarks
1. Each column in the input matrix corresponds to a separate time series variable.
2. The input matrix can have no more than twelve (12) columns (or variables).
3. Each row in the input matrix corresponds to an observation.
4. The number of cointegrating relationships should be no greater than the number of input variables.
5. The time series data are homogeneous or equally spaced.
6. The time series may include missing values (e.g. NaN) at either end.
7. There are two types of Johansen tests - with trace or with eigenvalue - and the inferences might be a bit different for each.
  • The null hypothesis for the trace test is the number of cointegration vectors \(r = 0\)
  • The null hypothesis for the eigenvalue test is \(r = m\)
Requirements
Header SFSDK.H
Library SFSDK.LIB
DLL SFSDK.DLL
Examples
const double NAN = std::numeric_limits<double>::quiet_NaN();


// We have 173 observations for 8 different factors
double US_MINING_EMPLOYMENT[173][8];

WORD wMaxOrder= 9;        // nlag = 9;
short nPolyOrder = 0;     // Only constant
BOOL  traceTest = TRUE;   // if traceTest = FALSE, then eignvalue based test 
WORD nNoRelations = 0;    // nNoRelations can be between 1 and 7
double alpha=0.05f;
double retStat=NAN;
double retCV=NAN;


// (1) Trace test
nRet = NDK_JOHANSENTEST(
  US_MINING_EMPLOYMENT,     // is the multivariate time series matrix data (two dimensional)
  173,                      // is the number of observations (rows) US_MINING_EMPLOYMENT.
  8 ,                       // is the number of variables (columns) in US_MINING_EMPLOYMENT.
  wMaxOrder,                // is the number of lagged difference terms used when computing the estimator
  nPolyOrder,               // is the order of the polynomial: 
                            // (-1=no constant, 0=contant-only (default), 1=constant and trend)
  traceTest,                // is a flag to select test: TRUE=trace, FALSE=maximal eignvalue test.
  nNoRelations,             // is the assumed number of cointegrating relationships between the variables.
  alpha,                    // is the statistical significance level (e.g. 5%). 
  &retStat,                 // is the calculated test statistics score.
  &retCV                    // is the calculated test critical value.
  );

// (8) Eignvalue test
nNoRelations = 0; 
traceTest = FALSE;
retStat=NAN;
retCV=NAN;
  
nRet = NDK_JOHANSENTEST(
  US_MINING_EMPLOYMENT,     // is the multivariate time series matrix data (two dimensional)
  173,                      // is the number of observations (rows) US_MINING_EMPLOYMENT.
  8 ,                       // is the number of variables (columns) in US_MINING_EMPLOYMENT.
  wMaxOrder,                // is the number of lagged difference terms used when computing the estimator
  nPolyOrder,               // is the order of the polynomial: 
                            // (-1=no constant, 0=contant-only (default), 1=constant and trend)
  traceTest,                // is a flag to select test: TRUE=trace, FALSE=maximal eignvalue test.
  nNoRelations,             // is the assumed number of cointegrating relationships between the variables.
  alpha,                    // is the statistical significance level (e.g. 5%). 
  &retStat,                 // is the calculated test statistics score.
  &retCV                    // is the calculated test critical value.
  );
    


   
Namespace:  NumXLAPI
Class:  SFSDK
Scope:  Public
Lifetime:  Static
 
int NDK_JOHANSENTEST(INtPtr pData,


UIntPtr nSize,


UIntPtr nVars,


UIntPtr maxOrder,


short nPolyOrder,


BOOL tracetest,


UInt16 nNoRelations,


double alpha,


ref double retStat,


ref double retCV 

)

Returns the Johansen (cointegration) test statistics for two or more 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]pDatais the multivariate time series matrix data (two dimensional).
[in]nSizeis the number of observations in pData.
[in]nVarsis the number of variables in pData.
[in]maxOrderis the number of lagged difference terms used when computing the estimator.
[in]nPolyOrderis the order of the polynomial: (-1=no constant, 0=contant-only (default), 1=constant and trend).
[in]tracetestis a flag to select test: TRUE=trace, FALSE=maximal eignvalue test.
[in]nNoRelationsis the assumed number of cointegrating relationships between the variables (if missing, r=1).
[in]alphais the statistical significance level. If missing, a default of 5% is assumed.
[out]retStatis the calculated test statistics score.
[out]retCVis the calculated test critical value.
Remarks
1. Each column in the input matrix corresponds to a separate time series variable.
2. The input matrix can have no more than twelve (12) columns (or variables).
3. Each row in the input matrix corresponds to an observation.
4. The number of cointegrating relationships should be no greater than the number of input variables.
5. The time series data are homogeneous or equally spaced.
6. The time series may include missing values (e.g. NaN) at either end.
7. There are two types of Johansen tests - with trace or with eigenvalue - and the inferences might be a bit different for each. 
  • The null hypothesis for the trace test is the number of cointegration vectors \(r = 0\)
  • The null hypothesis for the eigenvalue test is \(r = m\)
Exceptions
Exception Type Condition
None N/A
Requirements
Namespace NumXLAPI
Class SFSDK
Scope Public
Lifetime Static
Package 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