Auto-Regressive Moving Average (ARMA) Model functions. More...
Functions | |
| int __stdcall | NDK_ARMA_GOF (double *pData, size_t nSize, double mean, double sigma, double *phis, size_t p, double *thetas, size_t q, WORD retType, double *retVal) |
| Computes the goodness of fit measure (e.g., log-likelihood function (LLF), AIC, etc.) of the estimated ARMA model. | |
| int __stdcall | NDK_ARMA_RESID (double *pData, size_t nSize, double mean, double sigma, double *phis, size_t p, double *thetas, size_t q, WORD retType) |
| Returns the standardized residuals of a given ARMA model. | |
| int __stdcall | NDK_ARMA_PARAM (double *pData, size_t nSize, double *mean, double *sigma, double *phis, size_t p, double *thetas, size_t q, MODEL_RETVAL_FUNC retType, size_t maxIter) |
| Returns values for the quick guess, optimal (calibrated), or standard errors of the values of the model's parameters. | |
| int __stdcall | NDK_ARMA_FORE (double *pData, size_t nSize, double mean, double sigma, double *phis, size_t p, double *thetas, size_t q, size_t nSteps, FORECAST_RETVAL_FUNC retType, double alpha, double *retVal) |
| Calculates the out-of-sample arma-model forecast statistics. | |
| int __stdcall | NDK_ARMA_FITTED (double *pData, size_t nSize, double mean, double sigma, double *phis, size_t p, double *thetas, size_t q, FIT_RETVAL_FUNC retType) |
| Returns the fitted values (i.e. mean, volatility and residuals). | |
| int __stdcall | NDK_ARMA_VALIDATE (double mean, double sigma, double *phis, size_t p, double *thetas, size_t q) |
| Examines the model's parameters for stability constraints (e.g. stationarity, invertibility, causality, etc.). | |
| int __stdcall | NDK_ARMA_SIM (double mean, double sigma, double *phis, size_t p, double *thetas, size_t q, double *pData, size_t nSize, UINT nSeed, double *retArray, size_t nSteps) |
| Calculates the out-of-sample simulated values. | |
The auto-regressive moving average (ARMA) is a stationary stochastic process made up of sums of auto-regressive and moving average components. Alternatively, in a simple formulation for an ARMA (p, q):
\[x_t -\phi_o - \phi_1 x_{t-1}-\phi_2 x_{t-2}-\cdots -\phi_p x_{t-p}=a_t + \theta_1 a_{t-1} + \theta_2 a_{t-2} + \cdots + \theta_q a_{t-q} \]
Where:
Using back-shift notations (i.e., \(L\)), we can express the ARMA process as follows:
\[ (1-\phi_1 L - \phi_2 L^2 -\cdots - \phi_p L^p) x_t - \phi_o= (1+\theta_1 L+\theta_2 L^2 + \cdots + \theta_q L^q)a_t \]
Assuming \(y_t\) is stationary 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)\mu \]
Thus, the ARMA (p, q) process can now be expressed as:
\[ (1-\phi_1 L - \phi_2 L^2 -\cdots - \phi_p L^p) (x_t - \mu)= (1+\theta_1 L+\theta_2 L^2 + \cdots + \theta_q L^q)a_t\]
\[z_t = x_t - \mu \]
\[(1-\phi_1 L - \phi_2 L^2 -\cdots - \phi_p L^p) z_t = (1+\theta_1 L+\theta_2 L^2 + \cdots + \theta_q L^q)a_t \]
In sum, \(z_t \) is the original signal after we subtract its long-run average.
\[(1-\phi_1 L -\phi_{12} L^{12} )(y_t - \mu) = (1+\theta L^2)a_t \]
| int __stdcall NDK_ARMA_FITTED | ( | double * | pData, |
| size_t | nSize, | ||
| double | mean, | ||
| double | sigma, | ||
| double * | phis, | ||
| size_t | p, | ||
| double * | thetas, | ||
| size_t | q, | ||
| FIT_RETVAL_FUNC | retType ) |
Returns the fitted values (i.e. mean, volatility and residuals).
| [in,out] | pData | (Required) is the univariate time series data (a one dimensional array). | ||||||||||
| [in] | nSize | (Required) iis the number of observations in pData. | ||||||||||
| [in] | mean | (Optional) is the ARMA model mean (i.e. mu). | ||||||||||
| [in] | sigma | (Optional) iis the standard deviation of the model's residuals/innovations. | ||||||||||
| [in] | phis | (Optional) are the parameters of the AR(p) component model (starting with the lowest lag). | ||||||||||
| [in] | p | (Optional) is the number of elements in phis (order of AR component). | ||||||||||
| [in] | thetas | (Optional) are the parameters of the MA(q) component model (starting with the lowest lag). | ||||||||||
| [in] | q | (Optional) is the number of elements in thetas (order of MA component). | ||||||||||
| [in] | retType | (Required) s a switch to select a 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.phis):thetas):| Requirement | Value |
|---|---|
| Target Platform | Windows |
| Header | SFSDK.h (include Windows.h) |
| Library | SFSDK.lib |
| DLL | SFSDK.dll SFLUC.dll SFLOG.dll |
| int __stdcall NDK_ARMA_FORE | ( | double * | pData, |
| size_t | nSize, | ||
| double | mean, | ||
| double | sigma, | ||
| double * | phis, | ||
| size_t | p, | ||
| double * | thetas, | ||
| size_t | q, | ||
| size_t | nSteps, | ||
| FORECAST_RETVAL_FUNC | retType, | ||
| double | alpha, | ||
| double * | retVal ) |
Calculates the out-of-sample conditional forecast (i.e. mean, error, and confidence interval).
| [in] | pData | (Required) is the univariate time series data. | ||||||||||||
| [in] | nSize | (Required) iis the number of observations in pData. | ||||||||||||
| [in] | mean | (Optional) is the ARMA model mean (i.e. mu). | ||||||||||||
| [in] | sigma | (Optional) iis the standard deviation of the model's residuals/innovations. | ||||||||||||
| [in] | phis | (Optional) are the parameters of the AR(p) component model (starting with the lowest lag). | ||||||||||||
| [in] | p | (Optional) is the number of elements in phis (order of AR component). | ||||||||||||
| [in] | thetas | (Optional) are the parameters of the MA(q) component model (starting with the lowest lag). | ||||||||||||
| [in] | q | (Optional) is the number of elements in thetas (order of MA component). | ||||||||||||
| [in] | nSteps | (Optional) 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 (FORECAST_MEAN, FORECAST_STDEV , ..). (see FORECAST_RETVAL_FUNC).
| ||||||||||||
| [in] | alpha | (Required) is the statistical significance or confidence level (i.e. alpha). If missing or omitted, an alpha value of 5% is assumed. | ||||||||||||
| [out] | retVal | (Required) is a pointer to a variable to hold the calculated forecast 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.phis):thetas):| Requirement | Value |
|---|---|
| Target Platform | Windows |
| Header | SFSDK.h (include Windows.h) |
| Library | SFSDK.lib |
| DLL | SFSDK.dll SFLUC.dll SFLOG.dll |
| int __stdcall NDK_ARMA_GOF | ( | double * | pData, |
| size_t | nSize, | ||
| double | mean, | ||
| double | sigma, | ||
| double * | phis, | ||
| size_t | p, | ||
| double * | thetas, | ||
| size_t | q, | ||
| WORD | 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) is the ARMA model mean (i.e. mu). | ||||||||||||||
| [in] | sigma | (Optional) iis the standard deviation of the model's residuals/innovations. | ||||||||||||||
| [in] | phis | (Optional) are the parameters of the AR(p) component model (starting with the lowest lag). | ||||||||||||||
| [in] | p | (Optional) is the number of elements in phis (order of AR component). | ||||||||||||||
| [in] | thetas | (Optional) are the parameters of the MA(q) component model (starting with the lowest lag). | ||||||||||||||
| [in] | q | (Optional) is the number of elements in thetas (order of MA component). | ||||||||||||||
| [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.phis):thetas):| Requirement | Value |
|---|---|
| Target Platform | Windows |
| Header | SFSDK.h (include Windows.h) |
| Library | SFSDK.lib |
| DLL | SFSDK.dll SFLUC.dll SFLOG.dll |
| int __stdcall NDK_ARMA_PARAM | ( | double * | pData, |
| size_t | nSize, | ||
| double * | mean, | ||
| double * | sigma, | ||
| double * | phis, | ||
| size_t | p, | ||
| double * | thetas, | ||
| size_t | q, | ||
| MODEL_RETVAL_FUNC | retType, | ||
| size_t | maxIter ) |
Returns values for the quick guess, optimal (calibrated), or standard errors of the values of the model's parameters.
| [in] | pData | (Required) is the univariate time series data. | ||||||||
| [in] | nSize | (Required) iis the number of observations in pData. | ||||||||
| [in,out] | mean | (Optional) is the ARMA model mean (i.e. mu). | ||||||||
| [in,out] | sigma | (Optional) iis the standard deviation of the model's residuals/innovations. | ||||||||
| [in,out] | phis | (Optional) are the parameters of the AR(p) component model (starting with the lowest lag). | ||||||||
| [in] | p | (Optional) is the number of elements in phis (order of AR component). | ||||||||
| [in,out] | thetas | (Optional) are the parameters of the MA(q) component model (starting with the lowest lag). | ||||||||
| [in] | q | (Optional) is the number of elements in thetas (order of MA component). | ||||||||
| [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 none (i.e., 0), 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.phis):thetas):| Requirement | Value |
|---|---|
| Target Platform | Windows |
| Header | SFSDK.h (include Windows.h) |
| Library | SFSDK.lib |
| DLL | SFSDK.dll SFLUC.dll SFLOG.dll |
| int __stdcall NDK_ARMA_RESID | ( | double * | pData, |
| size_t | nSize, | ||
| double | mean, | ||
| double | sigma, | ||
| double * | phis, | ||
| size_t | p, | ||
| double * | thetas, | ||
| size_t | q, | ||
| WORD | retType ) |
Returns the standardized residuals of a given ARMA model
| [in,out] | pData | (Required) is the univariate time series data. | ||||||
| [in] | nSize | (Required) iis the number of observations in pData. | ||||||
| [in] | mean | (Optional) is the ARMA model mean (i.e. mu). | ||||||
| [in] | sigma | (Optional) iis the standard deviation of the model's residuals/innovations. | ||||||
| [in] | phis | (Optional) are the parameters of the AR(p) component model (starting with the lowest lag). | ||||||
| [in] | p | (Optional) is the number of elements in phis (order of AR component). | ||||||
| [in] | thetas | (Optional) are the parameters of the MA(q) component model (starting with the lowest lag). | ||||||
| [in] | q | (Optional) is the number of elements in thetas (order of MA component). | ||||||
| [in] | retType | (Required) is a switch to select a residuals-type:raw or standardized. see RESID_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.phis):thetas):| Requirement | Value |
|---|---|
| Target Platform | Windows |
| Header | SFSDK.h (include Windows.h) |
| Library | SFSDK.lib |
| DLL | SFSDK.dll SFLUC.dll SFLOG.dll |
| int __stdcall NDK_ARMA_SIM | ( | double | mean, |
| double | sigma, | ||
| double * | phis, | ||
| size_t | p, | ||
| double * | thetas, | ||
| size_t | q, | ||
| double * | pData, | ||
| size_t | nSize, | ||
| UINT | nSeed, | ||
| double * | retArray, | ||
| size_t | nSteps ) |
Calculates the out-of-sample simulated values.
| [in] | mean | (Optional) is the ARMA model mean (i.e. mu). |
| [in] | sigma | (Optional) is the standard deviation of the model's residuals/innovations. |
| [in] | phis | (Optional) are the parameters of the AR(p) component model (starting with the lowest lag). |
| [in] | p | (Optional) is the number of elements in phis (order of AR component). |
| [in] | thetas | (Optional) are the parameters of the MA(q) component model (starting with the lowest lag). |
| [in] | q | (Optional) is the number of elements in thetas (order of MA component). |
| [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 to initialize the psuedorandom number generator. |
| [out] | retArray | (Required) is the output array to hold nSteps future simulations. |
| [in] | nSteps | (Required) is the number of future steps to simulate for. |
| NDK_SUCCESS | success |
| NDK_INVALID_ARG | failed (see remarks) |
| NDK_LOW_LICENSE_ARG_LIMIT | failed (see remarks) |
| NDK_FAILED | failed |
phis):thetas):| Requirement | Value |
|---|---|
| Target Platform | Windows |
| Header | SFSDK.h (include Windows.h) |
| Library | SFSDK.lib |
| DLL | SFSDK.dll SFLUC.dll SFLOG.dll |
| int __stdcall NDK_ARMA_VALIDATE | ( | double | mean, |
| double | sigma, | ||
| double * | phis, | ||
| size_t | p, | ||
| double * | thetas, | ||
| size_t | q ) |
Examines the model's parameters for stability constraints (e.g. stationarity, invertibility, causality, etc.).
| [in] | mean | (Optional) is the ARMA model mean (i.e. mu). |
| [in] | sigma | (Optional) iis the standard deviation of the model's residuals/innovations. |
| [in] | phis | (Optional) are the parameters of the AR(p) component model (starting with the lowest lag). |
| [in] | p | (Optional) is the number of elements in phis (order of AR component). |
| [in] | thetas | (Optional) are the parameters of the MA(q) component model (starting with the lowest lag). |
| [in] | q | (Optional) is the number of elements in thetas (order of MA component). |
| NDK_TRUE | model is stable |
| NDK_FALSE | model is instable |
| NDK_INVALID_ARG | failed (see remarks) |
| NDK_FAILED | failed |
phis):thetas):| Requirement | Value |
|---|---|
| Target Platform | Windows |
| Header | SFSDK.h (include Windows.h) |
| Library | SFSDK.lib |
| DLL | SFSDK.dll SFLUC.dll SFLOG.dll |