Statistics and time-series analytics API

Seasonal ajustments using X12-ARIMA functions. More...

Data Structures

struct  X12ARIMA_OPTIONS
 

Enumerations

enum  X11_MODE_TYPE { X11_MODE_MULT = 0 , X11_MODE_ADD = 1 , X11_MODE_PSEUDOADD = 2 , X11_MODE_LOGADD = 3 }
 
enum  X11_SEASONALMA_TYPE {
  X11_SEASONALMA_3x1 = 0 , X11_SEASONALMA_3x3 = 1 , X11_SEASONALMA_3x5 = 2 , X11_SEASONALMA_3x9 = 3 ,
  X11_SEASONALMA_3x15 = 4 , X11_SEASONALMA_STABLE = 5 , X11_SEASONALMA_DEFAULT = 6 , X11_SEASONALMA_MSR =7
}
 

Functions

int __stdcall NDK_X12_ENV_INIT (BOOL override)
 
int __stdcall NDK_X12_ENV_CLEANUP (void)
 
int __stdcall NDK_X12_SCEN_INIT (LPCTSTR szScenarioName, LPVOID X12Options, size_t *ulModelHash)
 
int __stdcall NDK_X12_SCEN_READ (LPCTSTR szScenarioName, LPVOID X12Options, size_t *ulModelHash)
 
int __stdcall NDK_X12_SCEN_CLEAUP (LPCTSTR szScenarioName)
 
int __stdcall NDK_X12_DATA_FILE (LPCTSTR szScenarioName, double *X, size_t nLen, BOOL monthly, LONG startDate, WORD reserved, size_t *ulDataHash)
 
int __stdcall NDK_X12_READ_DATA_FILE (LPCTSTR szScenarioName, double *pData, size_t nLen, WORD fileType, size_t *ulDataHash)
 
int __stdcall NDK_X12_SPC_FILE (LPCTSTR szScenarioName, LPVOID X12Options, size_t *ulModelHash)
 
int __stdcall NDK_X12_RUN_BATCH (LPCTSTR szScenarioName, LPCTSTR szBatchFile, LPWORD status)
 
int __stdcall NDK_X12_RUN_SCENARIO (LPCTSTR szScenarioName, LPWORD status)
 
int __stdcall NDK_X12_RUN_STAT (LPCTSTR szScenarioName, LPWORD status, LPTSTR szMsg, size_t *nLen)
 
int __stdcall NDK_X12_OUT_FILE (LPCTSTR szScenarioName, WORD retType, LPTSTR szOutFile, size_t *nLen, BOOL OpenFileFlag)
 
int __stdcall NDK_X12_OUT_SERIES (LPCTSTR szScenarioName, WORD nComponent, double *pData, size_t *nLen)
 
int __stdcall NDK_X12_FORE_SERIES (LPCTSTR szScenarioName, size_t nStep, WORD retType, double *pData)
 

Detailed Description

The X-12-ARIMA software comes with extensive time series modeling and model selection capabilities for linear regression models with ARIMA errors (regARIMA models).

Enumeration Type Documentation

◆ X11_MODE_TYPE

X11 Modes

See also
Enumerator
X11_MODE_MULT 

multiplicative

X11_MODE_ADD 

additive

X11_MODE_PSEUDOADD 

pseudo-additive

X11_MODE_LOGADD 

log-additive

◆ X11_SEASONALMA_TYPE

X13 seasonal MA types

See also
Enumerator
X11_SEASONALMA_3x1 

3x1 CMA

X11_SEASONALMA_3x3 

3x3 CMA

X11_SEASONALMA_3x5 

3x5 CMA

X11_SEASONALMA_3x9 

3x9 CMA

X11_SEASONALMA_3x15 

3x15 CMA

X11_SEASONALMA_STABLE 

Stable CMA.

X11_SEASONALMA_DEFAULT 

3x3 MA and 3x5

X11_SEASONALMA_MSR 

X-11-ARIMA88.

Function Documentation

◆ NDK_X12_DATA_FILE()

int __stdcall NDK_X12_DATA_FILE ( LPCTSTR szScenarioName,
double * X,
size_t nLen,
BOOL monthly,
LONG startDate,
WORD reserved,
size_t * ulDataHash )

Write the given data into an X12a formatted data file

Returns
status code of the operation
Return values
NDK_SUCCESSOperation successful
NDK_FAILEDoperation is unsuccessful ( )
See also
NDK_X12_ENV_INIT(), NDK_X12_ENV_CLEANUP(), NDK_X12_SCEN_INIT(), NDK_X12_SCEN_CLEAUP(), NDK_X12_SPC_FILE(), NDK_X12_RUN_BATCH(), NDK_X12_RUN_SCENARIO(), NDK_X12_RUN_STAT(), NDK_X12_OUT_FILE(), NDK_X12_OUT_SERIES(), NDK_X12_FORE_SERIES()
Parameters
[in]szScenarioNameis the scenario name or the model unique identifier
[in]Xis the univariate time series data (a one dimensional array).
[in]nLenis the number of observations in X
[in]monthlyis a boolean flag for whether the data is monthly/quartelry sampled.
[in]startDateis the serial date number of the 1st observation in the series
[in]reservedis a reserved argument for future releases. must be set to 1
ulDataHash[inout] (optional) is CRC hash of the data file (tab delimated).

◆ NDK_X12_ENV_CLEANUP()

int __stdcall NDK_X12_ENV_CLEANUP ( void )

Finalize the X12A environment and release any resources allocated

Returns
status code of the operation
Return values
NDK_SUCCESSOperation successful
NDK_FAILEDoperation is unsuccessful ( )
See also
NDK_X12_ENV_INIT(), NDK_X12_SCEN_INIT(), NDK_X12_SCEN_CLEAUP(), NDK_X12_DATA_FILE(), NDK_X12_SPC_FILE(), NDK_X12_RUN_BATCH(), NDK_X12_RUN_SCENARIO(), NDK_X12_RUN_STAT(), NDK_X12_OUT_FILE(), NDK_X12_OUT_SERIES(), NDK_X12_FORE_SERIES()

◆ NDK_X12_ENV_INIT()

int __stdcall NDK_X12_ENV_INIT ( BOOL override)

Initialize the filesystem environment on the local machine for the current user

Note
1. This function creates a subfolder under the current user local profile for X12ARIMA models, and copy all the scripts needed to run the x12a program.
Returns
status code of the operation
Return values
NDK_SUCCESSOperation successful
NDK_FAILEDoperation is unsuccessful ( )
See also
NDK_X12_ENV_CLEANUP(), NDK_X12_SCEN_INIT(), NDK_X12_SCEN_CLEAUP(), NDK_X12_DATA_FILE(), NDK_X12_SPC_FILE(), NDK_X12_RUN_BATCH(), NDK_X12_RUN_SCENARIO(), NDK_X12_RUN_STAT(), NDK_X12_OUT_FILE(), NDK_X12_OUT_SERIES(), NDK_X12_FORE_SERIES()
Parameters
[in]overrideis a boolean flag to wipe our existing files and copy new ones.

◆ NDK_X12_FORE_SERIES()

int __stdcall NDK_X12_FORE_SERIES ( LPCTSTR szScenarioName,
size_t nStep,
WORD retType,
double * pData )

Read the output forecaste series generated by x12a program

Returns
status code of the operation
Return values
NDK_SUCCESSOperation successful
NDK_FAILEDoperation is unsuccessful ( )
See also
NDK_X12_ENV_INIT(), NDK_X12_ENV_CLEANUP(), NDK_X12_SCEN_INIT(), NDK_X12_SCEN_CLEAUP(), NDK_X12_DATA_FILE(), NDK_X12_SPC_FILE(), NDK_X12_RUN_BATCH(), NDK_X12_RUN_SCENARIO(), NDK_X12_RUN_STAT(), NDK_X12_OUT_FILE(), NDK_X12_OUT_SERIES()
Parameters
[in]szScenarioNameis the given X12-ARIMA scenario/model identifier
[in]nStepis the forecast horizon
[in]retTypeis the switch to designate desired output
  1. Mean
  2. Lower limit value of the conficent interval
  3. Upper limit value of the confidence interval
[out]pDatais the forecast output value

◆ NDK_X12_OUT_FILE()

int __stdcall NDK_X12_OUT_FILE ( LPCTSTR szScenarioName,
WORD retType,
LPTSTR szOutFile,
size_t * nLen,
BOOL OpenFileFlag )

Return the full path of the output file generated by x12a program

Returns
status code of the operation
Return values
NDK_SUCCESSOperation successful
NDK_FAILEDoperation is unsuccessful ( )
See also
NDK_X12_ENV_INIT(), NDK_X12_ENV_CLEANUP(), NDK_X12_SCEN_INIT(), NDK_X12_SCEN_CLEAUP(), NDK_X12_DATA_FILE(), NDK_X12_SPC_FILE(), NDK_X12_RUN_BATCH(), NDK_X12_RUN_SCENARIO(), NDK_X12_RUN_STAT(), NDK_X12_OUT_SERIES(), NDK_X12_FORE_SERIES()
Parameters
[in]szScenarioNameis the scenaio.model name
[in]retTypeis a switch to designate the desired specific output file.
  1. The X12 specification file (*.spc)
  2. The X12 log file
  3. The output file
  4. The error file
[out]szOutFileis a buffer to hold the return full path
nLen[inout] is the length of the szOutFile. Upon return, this argument stores the actual number of bytes used.
[in]OpenFileFlagis a switch to instruct the functiona whether it should open the file using system default editor (e.g. notepad)

◆ NDK_X12_OUT_SERIES()

int __stdcall NDK_X12_OUT_SERIES ( LPCTSTR szScenarioName,
WORD nComponent,
double * pData,
size_t * nLen )

Read the output time series (e.g. seasonal adjusted data) generated by x12a program

Returns
status code of the operation
Return values
NDK_SUCCESSOperation successful
NDK_FAILEDoperation is unsuccessful ( )
See also
NDK_X12_ENV_INIT(), NDK_X12_ENV_CLEANUP(), NDK_X12_SCEN_INIT(), NDK_X12_SCEN_CLEAUP(), NDK_X12_DATA_FILE(), NDK_X12_SPC_FILE(), NDK_X12_RUN_BATCH(), NDK_X12_RUN_SCENARIO(), NDK_X12_RUN_STAT(), NDK_X12_OUT_FILE(), NDK_X12_FORE_SERIES()
Parameters
[in]szScenarioNameis the given scenario/model
[in]nComponentis the desired output of the X12a output
  1. Final seasonal factors (d11)
  2. final trend-cycle (d12)
  3. final irregular component (d13)
  4. final seasonal factors (d10)
  5. combined holiday and trading day factors (d18)
  6. combined seasonal and trading day factors (d16)
[out]pDatais the output buffer to hold the data series
nLen[inout] is the original size of the output buffer. Upon return, nLen will have the actual number of data copied.

◆ NDK_X12_READ_DATA_FILE()

int __stdcall NDK_X12_READ_DATA_FILE ( LPCTSTR szScenarioName,
double * pData,
size_t nLen,
WORD fileType,
size_t * ulDataHash )

Read the scenario data file into the given data into an X12a formatted data file

Returns
status code of the operation
Return values
NDK_SUCCESSOperation successful
NDK_FAILEDoperation is unsuccessful ( )
See also
NDK_X12_ENV_INIT(), NDK_X12_ENV_CLEANUP(), NDK_X12_SCEN_INIT(), NDK_X12_SCEN_CLEAUP(), NDK_X12_SPC_FILE(), NDK_X12_RUN_BATCH(), NDK_X12_RUN_SCENARIO(), NDK_X12_RUN_STAT(), NDK_X12_OUT_FILE(), NDK_X12_OUT_SERIES(), NDK_X12_FORE_SERIES()
Parameters
[in]szScenarioNameis the scenario name or the model unique identifier
[out]pDatais the univariate time series data (a one dimensional array).
[in]nLenis the number of observations in pData
[in]fileTypeis a reserved argument for future releases. must be set to 1
[out]ulDataHash(optional) is CRC hash of the data file (tab delimated).

◆ NDK_X12_RUN_BATCH()

int __stdcall NDK_X12_RUN_BATCH ( LPCTSTR szScenarioName,
LPCTSTR szBatchFile,
LPWORD status )

Run a batch file in x12a environment

Returns
status code of the operation
Return values
NDK_SUCCESSOperation successful
NDK_FAILEDoperation is unsuccessful ( )
See also
NDK_X12_ENV_INIT(), NDK_X12_ENV_CLEANUP(), NDK_X12_SCEN_INIT(), NDK_X12_SCEN_CLEAUP(), NDK_X12_DATA_FILE(), NDK_X12_SPC_FILE(), NDK_X12_RUN_SCENARIO(), NDK_X12_RUN_STAT(), NDK_X12_OUT_FILE(), NDK_X12_OUT_SERIES(), NDK_X12_FORE_SERIES()
Parameters
[in]szScenarioNameis the scenario name or the model unique identifier
[in]szBatchFileis the batch file name to run
[out]statusis the status after running the batch file

◆ NDK_X12_RUN_SCENARIO()

int __stdcall NDK_X12_RUN_SCENARIO ( LPCTSTR szScenarioName,
LPWORD status )

Run a x12a program for the given model or scenrio

Returns
status code of the operation
Return values
NDK_SUCCESSOperation successful
NDK_FAILEDoperation is unsuccessful ( )
See also
NDK_X12_ENV_INIT(), NDK_X12_ENV_CLEANUP(), NDK_X12_SCEN_INIT(), NDK_X12_SCEN_CLEAUP(), NDK_X12_DATA_FILE(), NDK_X12_SPC_FILE(), NDK_X12_RUN_BATCH(), NDK_X12_RUN_STAT(), NDK_X12_OUT_FILE(), NDK_X12_OUT_SERIES(), NDK_X12_FORE_SERIES()
Parameters
[in]szScenarioNameis the scenario name or the model unique identifier
[out]statusis the status after running the batch file

◆ NDK_X12_RUN_STAT()

int __stdcall NDK_X12_RUN_STAT ( LPCTSTR szScenarioName,
LPWORD status,
LPTSTR szMsg,
size_t * nLen )

Read the status file generated by x12a program

Returns
status code of the operation
Return values
NDK_SUCCESSOperation successful
NDK_FAILEDoperation is unsuccessful ( )
See also
NDK_X12_ENV_INIT(), NDK_X12_ENV_CLEANUP(), NDK_X12_SCEN_INIT(), NDK_X12_SCEN_CLEAUP(), NDK_X12_DATA_FILE(), NDK_X12_SPC_FILE(), NDK_X12_RUN_BATCH(), NDK_X12_RUN_SCENARIO(), NDK_X12_OUT_FILE(), NDK_X12_OUT_SERIES(), NDK_X12_FORE_SERIES()
Parameters
[in]szScenarioNameis the scenario name or the model unique identifier
[out]statusis the status after running the batch file
[out]szMsgis the output buffer to copy the status message
nLen[in, out] is the sizxe of buffer szMsg

◆ NDK_X12_SCEN_CLEAUP()

int __stdcall NDK_X12_SCEN_CLEAUP ( LPCTSTR szScenarioName)

Finalize the given scenario/model and free allocated resources

Returns
status code of the operation
Return values
NDK_SUCCESSOperation successful
NDK_FAILEDoperation is unsuccessful ( )
See also
NDK_X12_ENV_INIT(), NDK_X12_ENV_CLEANUP(), NDK_X12_SCEN_INIT(), NDK_X12_DATA_FILE(), NDK_X12_SPC_FILE(), NDK_X12_RUN_BATCH(), NDK_X12_RUN_SCENARIO(), NDK_X12_RUN_STAT(), NDK_X12_OUT_FILE(), NDK_X12_OUT_SERIES(), NDK_X12_FORE_SERIES()
Parameters
[in]szScenarioNameis the scenario name or the model unique identifier

◆ NDK_X12_SCEN_INIT()

int __stdcall NDK_X12_SCEN_INIT ( LPCTSTR szScenarioName,
LPVOID X12Options,
size_t * ulModelHash )

Initialize the required files for the given scenario/model

Returns
status code of the operation
Return values
NDK_SUCCESSOperation successful
NDK_FAILEDoperation is unsuccessful ( )
See also
NDK_X12_ENV_INIT(), NDK_X12_ENV_CLEANUP(), NDK_X12_SCEN_CLEAUP(), NDK_X12_DATA_FILE(), NDK_X12_SPC_FILE(), NDK_X12_RUN_BATCH(), NDK_X12_RUN_SCENARIO(), NDK_X12_RUN_STAT(), NDK_X12_OUT_FILE(), NDK_X12_OUT_SERIES(), NDK_X12_FORE_SERIES()
Parameters
[in]szScenarioNameis the scenario name, must be unique
[in]X12Options(optional) is an instance of X12ARIMA_OPTIONS structure with all X12 model options.
ulModelHash[inout] (optional) CRC hash for the options.ini file

◆ NDK_X12_SCEN_READ()

int __stdcall NDK_X12_SCEN_READ ( LPCTSTR szScenarioName,
LPVOID X12Options,
size_t * ulModelHash )

Read the model configuration file

Returns
status code of the operation
Return values
NDK_SUCCESSOperation successful
NDK_FAILEDoperation is unsuccessful (e.g., scenario not found)
See also
NDK_X12_SCEN_INIT(), NDK_X12_ENV_CLEANUP(), NDK_X12_SCEN_CLEAUP(), NDK_X12_DATA_FILE(), NDK_X12_SPC_FILE(), NDK_X12_RUN_BATCH(), NDK_X12_RUN_SCENARIO(), NDK_X12_RUN_STAT(), NDK_X12_OUT_FILE(), NDK_X12_OUT_SERIES(), NDK_X12_FORE_SERIES()
Parameters
[in]szScenarioNameis the scenario name, must be unique
[out]X12Optionsis an instance of X12ARIMA_OPTIONS structure with all X12 model options.
[out]ulModelHash(optional) is CRC hash of the model option file (ini file).

◆ NDK_X12_SPC_FILE()

int __stdcall NDK_X12_SPC_FILE ( LPCTSTR szScenarioName,
LPVOID X12Options,
size_t * ulModelHash )

Create or updates the x12a specification file using the options selected

Returns
status code of the operation
Return values
NDK_SUCCESSOperation successful
NDK_FAILEDoperation is unsuccessful ( )
See also
NDK_X12_ENV_INIT(), NDK_X12_ENV_CLEANUP(), NDK_X12_SCEN_INIT(), NDK_X12_SCEN_CLEAUP(), NDK_X12_DATA_FILE(), NDK_X12_RUN_BATCH(), NDK_X12_RUN_SCENARIO(), NDK_X12_RUN_STAT(), NDK_X12_OUT_FILE(), NDK_X12_OUT_SERIES(), NDK_X12_FORE_SERIES()
Parameters
[in]szScenarioNameis the scenario name, must be unique
[in]X12Options(optional) is an instance of X12ARIMA_OPTIONS structure with all X12 model options.
ulModelHash[inout] (optional) CRC hash for the options.ini file