Auto-Regressive Moving Average (ARMA) Model functions.
More...
|
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:
- \(x_t \) is the observed output at time \(t \).
- \(a_t \) is the innovation, shock, or error term at time \(t \).
- \(p \) is the order of the last lagged variables.
- \(q \) is the order of the last lagged innovation or shock.
- \(a_t \) time series observations are independent and identically distributed (i.e., $i.i.d$) and follow a Gaussian distribution (i.e., \(\Phi(0,\sigma^2) \)).
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.
- Related Links
-
- References
- D. S.G. Pollock; Handbook of Time Series Analysis, Signal Processing, and Dynamics by D. S. G. Pollock; Academic Press; Har/Cdr edition(Nov 17, 1999), ISBN: 125609906.
- James Douglas Hamilton; Time Series Analysis by James Douglas Hamilton, Princeton University Press; 1st edition(Jan 11, 1994), ISBN: 691042896.
- Tsay, Ruey S.; Analysis of Financial Time Series by Ruey S. Tsay, John Wiley & SONS; 2nd edition(Aug 30, 2005), ISBN: 0-471-690740.
- Box, Jenkins and Reinsel; Time Series Analysis: Forecasting and Control by George E. P. Box & Gwilym M. Jenkins & Gregory C. Reinsel ; John Wiley & SONS.; 4th edition(Jun 30, 2008), ISBN: 470272848.
- Walter Enders; Applied Econometric Time Series by Walter Enders; Wiley; 4th edition(Nov 03, 2014), ISBN: 1118808568.
◆ NDK_ARMA_FITTED()
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).
- Parameters
-
[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).
Value | Output Type |
1 | Fitted conditional mean |
2 | Fitted conditional volatility or standard deviation |
3 | Raw residuals (actual - fitted mean) |
4 | Standardized residuals - (actual - fitted mean)/fitted volatility. |
|
- Returns
- status code of the function call: zero = success, positive = success with a warning, and negative = error occurred.
- Return values
-
- Requirements
Requirement | Value |
Target Platform | Windows |
Header | SFSDK.h (include Windows.h) |
Library | SFSDK.lib |
DLL | SFSDK.dll |
- Since
- v1.63
- See also
-
◆ NDK_ARMA_FORE()
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).
- Parameters
-
[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).
Value | Return |
1 | Mean Value (default) |
2 | Forecast standard error (aka local volatility) |
2 | Volatility term structure. |
3 | Lower limit of the forecast confidence interval. |
4 | Upper limit of the forecast confidence interval. |
|
[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. |
- Returns
- status code of the function call: zero = success, positive = success with a warning, and negative = error occurred.
- Return values
-
- Requirements
Requirement | Value |
Target Platform | Windows |
Header | SFSDK.h (include Windows.h) |
Library | SFSDK.lib |
DLL | SFSDK.dll |
- Since
- v1.63
- See also
-
◆ NDK_ARMA_GOF()
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.
- Parameters
-
[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) is a switch to select the return output (1 = Mean Value (default), 2 = Std Error, 3 = Test Score, 4 = P-Value, 5 = Upper Value, 6 = Lower Value). ( see GOODNESS_OF_FIT_FUNC)
Value | Return |
1 | Mean Value (default) |
2 | Standard Error. |
3 | Upper Limit. |
4 | Lower Limit. |
|
[out] | retVal | (Required) is a pointer to a variable to hold the calculated test statistics. |
- Returns
- status code of the function call: zero = success, positive = success with a warning, and negative = error occurred.
- Return values
-
- Requirements
Requirement | Value |
Target Platform | Windows |
Header | SFSDK.h (include Windows.h) |
Library | SFSDK.lib |
DLL | SFSDK.dll |
- Since
- v1.63
- See also
-
◆ NDK_ARMA_PARAM()
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.
- 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).
Value | Type |
1 | Quick guess (non-optimal) of parameters values |
2 | Run a calibration process to find optimal values for the model's parameters |
3 | Compute the standard error of the parameters' values |
|
[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. |
- Returns
- status code of the function call: zero = success, positive = success with a warning, and negative = error occurred.
- Return values
-
- Requirements
Requirement | Value |
Target Platform | Windows |
Header | SFSDK.h (include Windows.h) |
Library | SFSDK.lib |
DLL | SFSDK.dll |
- Since
- v1.63
- See also
-
◆ NDK_ARMA_RESID()
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
- Parameters
-
[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
Value | Residuals Type |
0 | Standardized residuals |
1 | Raw Residuals |
|
- Returns
- status code of the function call: zero = success, positive = success with a warning, and negative = error occurred.
- Return values
-
- Requirements
Requirement | Value |
Target Platform | Windows |
Header | SFSDK.h (include Windows.h) |
Library | SFSDK.lib |
DLL | SFSDK.dll |
- Since
- v1.63
- See also
-
◆ NDK_ARMA_SIM()
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.
- Parameters
-
[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. |
- Returns
- status code of the function call: zero = success, positive = success with a warning, and negative = error occurred.
- Return values
-
- Requirements
Requirement | Value |
Target Platform | Windows |
Header | SFSDK.h (include Windows.h) |
Library | SFSDK.lib |
DLL | SFSDK.dll |
- Since
- v1.63
- See also
-
◆ NDK_ARMA_VALIDATE()
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.).
- Parameters
-
[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). |
- Returns
- status code of the function call: zero = success, positive = success with a warning, and negative = error occurred.
- Return values
-
- Requirements
Requirement | Value |
Target Platform | Windows |
Header | SFSDK.h (include Windows.h) |
Library | SFSDK.lib |
DLL | SFSDK.dll |
- Since
- v1.63
- See also
-