Seasonal Autoregressive Integrated Moving Average (SARIMA) Model. More...
Functions | |
int __stdcall | NDK_SARIMA_GOF (double *pData, size_t nSize, double mean, double sigma, WORD nIntegral, double *phis, size_t p, double *thetas, size_t q, WORD nSIntegral, WORD nSPeriod, double *sPhis, size_t sP, double *sThetas, size_t sQ, GOODNESS_OF_FIT_FUNC retType, double *retVal) |
Computes the goodness of fit measure (e.g., log-likelihood function (LLF), AIC, etc.) of the estimated ARIMA model. | |
int __stdcall | NDK_SARIMA_PARAM (double *pData, size_t nSize, double *mean, double *sigma, WORD nIntegral, double *phis, size_t p, double *thetas, size_t q, WORD nSIntegral, WORD nSPeriod, double *sPhis, size_t sP, double *sThetas, size_t sQ, MODEL_RETVAL_FUNC retType, size_t maxIter) |
Returns the quick guess, optimal (calibrated) or std. errors of the values of model's parameters. | |
int __stdcall | NDK_SARIMA_SIM (double mean, double sigma, WORD nIntegral, double *phis, size_t p, double *thetas, size_t q, WORD nSIntegral, WORD nSPeriod, double *sPhis, size_t sP, double *sThetas, size_t sQ, double *pData, size_t nSize, size_t nSeed, double *retVal, size_t nStep) |
Returns the quick guess, optimal (calibrated) or std. errors of the values of model's parameters. | |
int __stdcall | NDK_SARIMA_FORE (double *pData, size_t nSize, double mean, double sigma, WORD nIntegral, double *phis, size_t p, double *thetas, size_t q, WORD nSIntegral, WORD nSPeriod, double *sPhis, size_t sP, double *sThetas, size_t sQ, size_t nStep, FORECAST_RETVAL_FUNC retType, double alpha, double *retVal) |
Returns the quick guess, optimal (calibrated) or std. errors of the values of model's parameters. | |
int __stdcall | NDK_SARIMA_FITTED (double *pData, size_t nSize, double mean, double sigma, WORD nIntegral, double *phis, size_t p, double *thetas, size_t q, WORD nSIntegral, WORD nSPeriod, double *sPhis, size_t sP, double *sThetas, size_t sQ, FIT_RETVAL_FUNC retType) |
Returns the quick guess, optimal (calibrated) or std. errors of the values of model's parameters. | |
int __stdcall | NDK_SARIMA_VALIDATE (double mean, double sigma, WORD nIntegral, double *phis, size_t p, double *thetas, size_t q, WORD nSIntegral, WORD nSPeriod, double *sPhis, size_t sP, double *sThetas, size_t sQ) |
Examines the model's parameters for stability constraints (e.g. stationarity, invertibility, causality, etc.). | |
The SARIMA model is an extension of the ARIMA model, often used when we suspect a model may have a seasonal effect.
By definition, the seasonal auto-regressive integrated moving average - SARIMA(p, d, q)(P, D, Q)s - process is a multiplicative of two ARMA processes of the differenced time series.
\[(1-\sum_{i=1}^p {\phi_i L^i})(1-\sum_{j=1}^P {\Phi_j L^{j \times s}})(1-L)^d (1-L^s)^D x_t = (1+\sum_{i=1}^q {\theta_i L^i})(1+\sum_{j=1}^Q {\Theta_j L^{j \times s}}) a_t\]
\[y_t = (1-L)^d (1-L^s)^D \]
Where:
Assuming \(y_t\) follows a stationary process with a long run mean of \(\mu\), then taking the expectation from both sides, we can express \(\phi_o\) as follows:
\[\phi_o = (1-\phi_1-\phi_2-\cdots-\phi_p)(1-\Phi_1-\Phi_2-\cdots-\Phi_P)\]
Thus, the SARIMA(p, d, q)(P, D, Q)s process can now be expressed as:
\[(1-\sum_{i=1}^p {\phi_i L^i})(1-\sum_{j=1}^P {\Phi_j L^{j \times s}}) (y_t -\mu) = (1+\sum_{i=1}^q {\theta_i L^i})(1+\sum_{j=1}^Q {\Theta_j L^{j \times s}}) a_t\]
\[z_t=y_t-\mu \]
\[(1-\sum_{i=1}^p {\phi_i L^i})(1-\sum_{j=1}^P {\Phi_j L^{j \times s}}) z_t = (1+\sum_{i=1}^q {\theta_i L^i})(1+\sum_{j=1}^Q {\Theta_j L^{j \times s}}) a_t\]
In sum, \(z_t\) is the differenced signal after we subtract its long-run average.
\[(1-L)(1-L^{12})x_t-\mu = (1+\theta L)(1+\Theta L^{12})a_t \]
This is the AIRLINE model, a special case of the SARIMA model.int __stdcall NDK_SARIMA_FITTED | ( | double * | pData, |
size_t | nSize, | ||
double | mean, | ||
double | sigma, | ||
WORD | nIntegral, | ||
double * | phis, | ||
size_t | p, | ||
double * | thetas, | ||
size_t | q, | ||
WORD | nSIntegral, | ||
WORD | nSPeriod, | ||
double * | sPhis, | ||
size_t | sP, | ||
double * | sThetas, | ||
size_t | sQ, | ||
FIT_RETVAL_FUNC | retType ) |
Returns the in-sample model fitted values of the conditional mean, volatility or residuals.
[in,out] | pData | (Required) a univariate time series data. | ||||||||||
[in] | nSize | (Required) the number of observations in pData . | ||||||||||
[in] | mean | (Optional) the ARMA model mean, i.e., \(\mu \). | ||||||||||
[in] | sigma | (Required) the standard deviation of the model's residuals/innovations (i.e., \(\sigma \)).. | ||||||||||
[in] | nIntegral | (Required) the non-seasonal difference order (i.e., \( d \)). | ||||||||||
[in] | phis | (Optional) the parameters of the AR(p) component model (starting with the lowest lag), i.e., \( [\phi] \). | ||||||||||
[in] | p | (Optional) the number of elements in phis (order of AR component, i.e., \( p \)). | ||||||||||
[in] | thetas | (Optional) the parameters of the MA(q) component model (starting with the lowest lag), i.e., \( [\theta] \). | ||||||||||
[in] | q | (Optional) the number of elements in thetas (order of MA component, i.e., \( q \)). | ||||||||||
[in] | nSIntegral | (Optional) the seasonal difference (i.e., \( D \)). | ||||||||||
[in] | nSPeriod | (Optional) the number of observations per one period (e.g. 12=Annual, 4=Quarter), i.e., \( s \). | ||||||||||
[in] | sPhis | (Optional) the parameters of of the seasonal AR component , i.e., \( [\Phi] \). | ||||||||||
[in] | sP | (Optional) the order of the seasonal AR component, i.e., \( P \). | ||||||||||
[in] | sThetas | (Optional) the parameters of the seasonal MA component, i.e., \( [\Theta] \). | ||||||||||
[in] | sQ | (Optional) the order of the seasonal MA component, i.e., \( Q \). | ||||||||||
[in] | retType | (Required) a switch to select the desired output type (see FIT_RETVAL_FUNC).
|
NDK_SUCCESS | success |
NDK_INVALID_ARG | failed (see remarks) |
NDK_LOW_LICENSE_ARG_LIMIT | failed (see remarks) |
NDK_FAILED | failed |
nSize
is zero, the function will fail and return NDK_INVALID_ARG.retVal
argument is NULL, the function will fails and return NDK_INVALID_ARG.Requirement | Value |
---|---|
Target Platform | Windows |
Header | SFSDK.h (include Windows.h) |
Library | SFSDK.lib |
DLL | SFSDK.dll SFLUC.dll SFLOG.dll |
int __stdcall NDK_SARIMA_FORE | ( | double * | pData, |
size_t | nSize, | ||
double | mean, | ||
double | sigma, | ||
WORD | nIntegral, | ||
double * | phis, | ||
size_t | p, | ||
double * | thetas, | ||
size_t | q, | ||
WORD | nSIntegral, | ||
WORD | nSPeriod, | ||
double * | sPhis, | ||
size_t | sP, | ||
double * | sThetas, | ||
size_t | sQ, | ||
size_t | nStep, | ||
FORECAST_RETVAL_FUNC | retType, | ||
double | alpha, | ||
double * | retVal ) |
Calculates the out-of-sample forecast statistics.
[in] | pData | (Required) is the univariate time series data. | ||||||||||||
[in] | nSize | (Required) iis the number of observations in pData . | ||||||||||||
[in] | mean | (Optional) the ARMA model mean, i.e., \(\mu \). | ||||||||||||
[in] | sigma | (Required) the standard deviation of the model's residuals/innovations (i.e., \(\sigma \)).. | ||||||||||||
[in] | nIntegral | (Required) the non-seasonal difference order (i.e., \( d \)). | ||||||||||||
[in] | phis | (Optional) the parameters of the AR(p) component model (starting with the lowest lag), i.e., \( [\phi] \). | ||||||||||||
[in] | p | (Optional) the number of elements in phis (order of AR component, i.e., \( p \)). | ||||||||||||
[in] | thetas | (Optional) the parameters of the MA(q) component model (starting with the lowest lag), i.e., \( [\theta] \). | ||||||||||||
[in] | q | (Optional) the number of elements in thetas (order of MA component, i.e., \( q \)). | ||||||||||||
[in] | nSIntegral | (Optional) the seasonal difference (i.e., \( D \)). | ||||||||||||
[in] | nSPeriod | (Optional) the number of observations per one period (e.g. 12=Annual, 4=Quarter), i.e., \( s \). | ||||||||||||
[in] | sPhis | (Optional) the parameters of of the seasonal AR component , i.e., \( [\Phi] \). | ||||||||||||
[in] | sP | (Optional) the order of the seasonal AR component, i.e., \( P \). | ||||||||||||
[in] | sThetas | (Optional) the parameters of the seasonal MA component, i.e., \( [\Theta] \). | ||||||||||||
[in] | sQ | (Optional) the order of the seasonal MA component, i.e., \( Q \). | ||||||||||||
[in] | nStep | (Required) is the forecast time/horizon (expressed in terms of steps beyond end of the time series). | ||||||||||||
[in] | retType | (Required) is a switch to select the type of value returned. (see FORECAST_RETVAL_FUNC).
| ||||||||||||
[in] | alpha | (Required) is the statistical significance level. If missing, a default of 5% is assumed. | ||||||||||||
[out] | retVal | (Required) is the calculated forecast value. |
NDK_SUCCESS | success |
NDK_INVALID_ARG | failed (see remarks) |
NDK_LOW_LICENSE_ARG_LIMIT | failed (see remarks) |
NDK_FAILED | failed |
nSize
is zero, the function will fail and return NDK_INVALID_ARG.retVal
argument is NULL, the function will fails and return NDK_INVALID_ARG.Requirement | Value |
---|---|
Target Platform | Windows |
Header | SFSDK.h (include Windows.h) |
Library | SFSDK.lib |
DLL | SFSDK.dll SFLUC.dll SFLOG.dll |
int __stdcall NDK_SARIMA_GOF | ( | double * | pData, |
size_t | nSize, | ||
double | mean, | ||
double | sigma, | ||
WORD | nIntegral, | ||
double * | phis, | ||
size_t | p, | ||
double * | thetas, | ||
size_t | q, | ||
WORD | nSIntegral, | ||
WORD | nSPeriod, | ||
double * | sPhis, | ||
size_t | sP, | ||
double * | sThetas, | ||
size_t | sQ, | ||
GOODNESS_OF_FIT_FUNC | retType, | ||
double * | retVal ) |
Computes the log-likelihood (LLF), Akaike Information Criterion (AIC) or other goodness of fit functions of the ARMA model.
[in] | pData | (Required) is the univariate time series data. | ||||||||||||||
[in] | nSize | (Required) iis the number of observations in pData . | ||||||||||||||
[in] | mean | (Optional) the ARMA model mean, i.e., \(\mu \). | ||||||||||||||
[in] | sigma | (Required) the standard deviation of the model's residuals/innovations (i.e., \(\sigma \)).. | ||||||||||||||
[in] | nIntegral | (Required) the non-seasonal difference order (i.e., \( d \)). | ||||||||||||||
[in] | phis | (Optional) the parameters of the AR(p) component model (starting with the lowest lag), i.e., \( [\phi] \). | ||||||||||||||
[in] | p | (Optional) the number of elements in phis (order of AR component, i.e., \( p \)). | ||||||||||||||
[in] | thetas | (Optional) the parameters of the MA(q) component model (starting with the lowest lag), i.e., \( [\theta] \). | ||||||||||||||
[in] | q | (Optional) the number of elements in thetas (order of MA component, i.e., \( q \)). | ||||||||||||||
[in] | nSIntegral | (Optional) the seasonal difference (i.e., \( D \)). | ||||||||||||||
[in] | nSPeriod | (Optional) the number of observations per one period (e.g. 12=Annual, 4=Quarter), i.e., \( s \). | ||||||||||||||
[in] | sPhis | (Optional) the parameters of of the seasonal AR component , i.e., \( [\Phi] \). | ||||||||||||||
[in] | sP | (Optional) the order of the seasonal AR component, i.e., \( P \). | ||||||||||||||
[in] | sThetas | (Optional) the parameters of the seasonal MA component, i.e., \( [\Theta] \). | ||||||||||||||
[in] | sQ | (Optional) the order of the seasonal MA component, i.e., \( Q \). | ||||||||||||||
[in] | retType | (Required) a switch to select a fitness measure ( see GOODNESS_OF_FIT_FUNC).
| ||||||||||||||
[out] | retVal | (Required) is a pointer to a variable to hold the calculated GOF statistics. |
NDK_SUCCESS | success |
NDK_INVALID_ARG | failed (see remarks) |
NDK_LOW_LICENSE_ARG_LIMIT | failed (see remarks) |
NDK_FAILED | failed |
nSize
is zero, the function will fail and return NDK_INVALID_ARG.retVal
argument is NULL, the function will fails and return NDK_INVALID_ARG.Requirement | Value |
---|---|
Target Platform | Windows |
Header | SFSDK.h (include Windows.h) |
Library | SFSDK.lib |
DLL | SFSDK.dll SFLUC.dll SFLOG.dll |
int __stdcall NDK_SARIMA_PARAM | ( | double * | pData, |
size_t | nSize, | ||
double * | mean, | ||
double * | sigma, | ||
WORD | nIntegral, | ||
double * | phis, | ||
size_t | p, | ||
double * | thetas, | ||
size_t | q, | ||
WORD | nSIntegral, | ||
WORD | nSPeriod, | ||
double * | sPhis, | ||
size_t | sP, | ||
double * | sThetas, | ||
size_t | sQ, | ||
MODEL_RETVAL_FUNC | retType, | ||
size_t | maxIter ) |
Returns the initial (non-optimal), optimal or standard errors of the model's parameters.
[in,out] | pData | (Required) is the univariate time series data (a one dimensional array). | ||||||||
[in] | nSize | (Required) is the number of observations in pData . | ||||||||
[in,out] | mean | (Optional) the ARMA model mean, i.e., \(\mu \). | ||||||||
[in,out] | sigma | (Required) the standard deviation of the model's residuals/innovations (i.e., \(\sigma \)).. | ||||||||
[in] | nIntegral | (Required) the non-seasonal difference order (i.e., \( d \)). | ||||||||
[in,out] | phis | (Optional) the parameters of the AR(p) component model (starting with the lowest lag), i.e., \( [\phi] \). | ||||||||
[in] | p | (Optional) the number of elements in phis (order of AR component, i.e., \( p \)). | ||||||||
[in,out] | thetas | (Optional) the parameters of the MA(q) component model (starting with the lowest lag), i.e., \( [\theta] \). | ||||||||
[in] | q | (Optional) the number of elements in thetas (order of MA component, i.e., \( q \)). | ||||||||
[in] | nSIntegral | (Optional) the seasonal difference (i.e., \( D \)). | ||||||||
[in] | nSPeriod | (Optional) the number of observations per one period (e.g. 12=Annual, 4=Quarter), i.e., \( s \). | ||||||||
[in,out] | sPhis | (Optional) the parameters of of the seasonal AR component , i.e., \( [\Phi] \). | ||||||||
[in] | sP | (Optional) the order of the seasonal AR component, i.e., \( P \). | ||||||||
[in,out] | sThetas | (Optional) the parameters of the seasonal MA component, i.e., \( [\Theta] \). | ||||||||
[in] | sQ | (Optional) the order of the seasonal MA component, i.e., \( Q \). | ||||||||
[in] | retType | (Required) is a switch to select the type of value returned: 1= Quick Guess, 2=Calibrated, 3= Std. Errors ( see MODEL_RETVAL_FUNC).
| ||||||||
[in] | maxIter | (Required) is the maximum number of iterations used to calibrate the model. If missing or less than 100, the default maximum of 100 is assumed. |
NDK_SUCCESS | success |
NDK_INVALID_ARG | failed (see remarks) |
NDK_LOW_LICENSE_ARG_LIMIT | failed (see remarks) |
NDK_FAILED | failed |
nSize
is zero, the function will fail and return NDK_INVALID_ARG.retVal
argument is NULL, the function will fails and return NDK_INVALID_ARG.Requirement | Value |
---|---|
Target Platform | Windows |
Header | SFSDK.h (include Windows.h) |
Library | SFSDK.lib |
DLL | SFSDK.dll SFLUC.dll SFLOG.dll |
int __stdcall NDK_SARIMA_SIM | ( | double | mean, |
double | sigma, | ||
WORD | nIntegral, | ||
double * | phis, | ||
size_t | p, | ||
double * | thetas, | ||
size_t | q, | ||
WORD | nSIntegral, | ||
WORD | nSPeriod, | ||
double * | sPhis, | ||
size_t | sP, | ||
double * | sThetas, | ||
size_t | sQ, | ||
double * | pData, | ||
size_t | nSize, | ||
size_t | nSeed, | ||
double * | retVal, | ||
size_t | nStep ) |
Returns the initial (non-optimal), optimal or standard errors of the model's parameters.
[in] | mean | (Optional) the ARMA model mean, i.e., \(\mu \). |
[in] | sigma | (Required) the standard deviation of the model's residuals/innovations (i.e., \(\sigma \)).. |
[in] | nIntegral | (Required) the non-seasonal difference order (i.e., \( d \)). |
[in] | phis | (Optional) the parameters of the AR(p) component model (starting with the lowest lag), i.e., \( [\phi] \). |
[in] | p | (Optional) the number of elements in phis (order of AR component, i.e., \( p \)). |
[in] | thetas | (Optional) the parameters of the MA(q) component model (starting with the lowest lag), i.e., \( [\theta] \). |
[in] | q | (Optional) the number of elements in thetas (order of MA component, i.e., \( q \)). |
[in] | nSIntegral | (Optional) the seasonal difference (i.e., \( D \)). |
[in] | nSPeriod | (Optional) the number of observations per one period (e.g. 12=Annual, 4=Quarter), i.e., \( s \). |
[in] | sPhis | (Optional) the parameters of of the seasonal AR component , i.e., \( [\Phi] \). |
[in] | sP | (Optional) the order of the seasonal AR component, i.e., \( P \). |
[in] | sThetas | (Optional) the parameters of the seasonal MA component, i.e., \( [\Theta] \). |
[in] | sQ | (Optional) the order of the seasonal MA component, i.e., \( Q \). |
[in] | pData | (Required) The values of the latest (most recent) observations. |
[in] | nSize | (Required) is the number of observations in pData . |
[in] | nSeed | (Required) is an unsigned integer for setting up the random number generators. |
[out] | retVal | (Required) is the calculated simulation value. |
[in] | nStep | (Required) is the simulation time/horizon (expressed in terms of steps beyond end of the time series). |
NDK_SUCCESS | success |
NDK_INVALID_ARG | failed (see remarks) |
NDK_LOW_LICENSE_ARG_LIMIT | failed (see remarks) |
NDK_FAILED | failed |
nSize
is zero, the function will fail and return NDK_INVALID_ARG.retVal
argument is NULL, the function will fails and return NDK_INVALID_ARG.Requirement | Value |
---|---|
Target Platform | Windows |
Header | SFSDK.h (include Windows.h) |
Library | SFSDK.lib |
DLL | SFSDK.dll SFLUC.dll SFLOG.dll |
int __stdcall NDK_SARIMA_VALIDATE | ( | double | mean, |
double | sigma, | ||
WORD | nIntegral, | ||
double * | phis, | ||
size_t | p, | ||
double * | thetas, | ||
size_t | q, | ||
WORD | nSIntegral, | ||
WORD | nSPeriod, | ||
double * | sPhis, | ||
size_t | sP, | ||
double * | sThetas, | ||
size_t | sQ ) |
Examines the model's parameters for stability constraints (e.g. stationarity, invertibility, causality, etc.).
[in] | mean | (Optional) the ARMA model mean, i.e., \(\mu \). |
[in] | sigma | (Required) the standard deviation of the model's residuals/innovations (i.e., \(\sigma \)).. |
[in] | nIntegral | (Required) the non-seasonal difference order (i.e., \( d \)). |
[in] | phis | (Optional) the parameters of the AR(p) component model (starting with the lowest lag), i.e., \( [\phi] \). |
[in] | p | (Optional) the number of elements in phis (order of AR component, i.e., \( p \)). |
[in] | thetas | (Optional) the parameters of the MA(q) component model (starting with the lowest lag), i.e., \( [\theta] \). |
[in] | q | (Optional) the number of elements in thetas (order of MA component, i.e., \( q \)). |
[in] | nSIntegral | (Optional) the seasonal difference (i.e., \( D \)). |
[in] | nSPeriod | (Optional) the number of observations per one period (e.g. 12=Annual, 4=Quarter), i.e., \( s \). |
[in] | sPhis | (Optional) the parameters of of the seasonal AR component , i.e., \( [\Phi] \). |
[in] | sP | (Optional) the order of the seasonal AR component, i.e., \( P \). |
[in] | sThetas | (Optional) the parameters of the seasonal MA component, i.e., \( [\Theta] \). |
[in] | sQ | (Optional) the order of the seasonal MA component, i.e., \( Q \). |
NDK_TRUE | model is stable |
NDK_FALSE | model is instable |
NDK_INVALID_ARG | failed (see remarks) |
NDK_FAILED | failed |
Requirement | Value |
---|---|
Target Platform | Windows |
Header | SFSDK.h (include Windows.h) |
Library | SFSDK.lib |
DLL | SFSDK.dll SFLUC.dll SFLOG.dll |