GARCH-in-mean (GARCH-M) model functions. More...
Functions | |
int __stdcall | NDK_GARCHM_GOF (double *pData, size_t nSize, double mu, double flambda, const double *Alphas, size_t p, const double *Betas, size_t q, WORD nInnovationType, double nu, WORD retType, double *retVal) |
Computes the log-likelihood (LLF), Akaike Information Criterion (AIC) or other goodness of fit functions of the GARCH-M model. | |
int __stdcall | NDK_GARCHM_RESID (double *pData, size_t nSize, double mu, double flambda, const double *Alphas, size_t p, const double *Betas, size_t q, WORD nInnovationType, double nu, WORD retType) |
Returns an array of cells for the standardized residuals of a given GARCH-M model. | |
int __stdcall | NDK_GARCHM_PARAM (double *pData, size_t nSize, double *mu, double *flambda, double *Alphas, size_t p, double *Betas, size_t q, WORD nInnovationType, double *nu, WORD retType, size_t maxIter) |
Returns the initial (non-optimal), optimal or standard errors of the model's parameters. | |
int __stdcall | NDK_GARCHM_SIM (double mu, double flambda, const double *Alphas, size_t p, const double *Betas, size_t q, WORD nInnovationType, double nu, double *pData, size_t nSize, double *pSigmas, size_t nSigmaSize, UINT nSeed, double *retArray, size_t nSteps) |
Returns a simulated data series the underlying GARCH process. | |
int __stdcall | NDK_GARCHM_FORE (double *pData, size_t nSize, double *pVols, size_t nVolSize, double mu, double flambda, const double *Alphas, size_t p, const double *Betas, size_t q, WORD nInnovationType, double nu, size_t nSteps, WORD retType, double alpha, double *retVal) |
Returns a simulated data series the underlying GARCH process. | |
int __stdcall | NDK_GARCHM_FITTED (double *pData, size_t nSize, double mu, double flambda, const double *Alphas, size_t p, const double *Betas, size_t q, WORD nInnovationType, double nu, WORD retType) |
Returns an array of cells for the fitted values (i.e. mean, volatility and residuals). | |
int __stdcall | NDK_GARCHM_LRVAR (double mu, double lambda, const double *Alphas, size_t p, const double *Betas, size_t q, WORD nInnovationType, double nu, double *retVal) |
Calculates the long-run average volatility for the given GARCH model. | |
int __stdcall | NDK_GARCHM_VALIDATE (double mu, double lambda, const double *Alphas, size_t p, const double *Betas, size_t q, WORD nInnovationType, double nu) |
Examines the model's parameters for stability constraints (e.g. stationary, etc.). | |
In finance, the return of a security may depend on its volatility (risk). To model such phenomena, the GARCH-in-mean (GARCH-M) model adds a heteroskedasticity term into the mean equation. The GARCH-M (p, q) model is written as:
\[x_t = \mu + \lambda \sigma_t + a_t \]
\[\sigma_t^2 = \alpha_o + \sum_{i=1}^p {\alpha_i a_{t-i}^2}+\sum_{j=1}^q{\beta_j \sigma_{t-j}^2}\]
\[a_t = \sigma_t \times \epsilon_t \]
\[\epsilon_t \sim P_{\nu}(0,1)\]
Where:
\[\left[\epsilon_t \right]\sim i.i.d\]
\[E\left[\epsilon_t\right]=0\]
\[\mathit{VAR}\left[\epsilon_t\right]=1\]
\[P_{\nu} = N(0,1)\]
\[P_{\nu} = t_{\nu}(0,1)\]
\[\nu \gt 4\]
\[P_{\nu} = \mathit{GED}_{\nu}(0,1)\]
\[\nu \gt 1\]
int __stdcall NDK_GARCHM_FITTED | ( | double * | pData, |
size_t | nSize, | ||
double | mu, | ||
double | flambda, | ||
const double * | Alphas, | ||
size_t | p, | ||
const double * | Betas, | ||
size_t | q, | ||
WORD | nInnovationType, | ||
double | nu, | ||
WORD | retType ) |
Returns an array of cells for the fitted values (i.e. mean, volatility and residuals).
[in,out] | pData | (Required) The univariate time series data. | ||||||||||
[in] | nSize | (Required) The number of observations in pData . | ||||||||||
[in] | mu | (Optional) The GARCH model conditional mean (i.e. mu). | ||||||||||
[in] | flambda | (Optional) The volatility coefficient for the mean. In finance, lambda is referenced as the risk premium. | ||||||||||
[in] | Alphas | (Optional) The parameters of the ARCH(p) component model (starting with the lowest lag). | ||||||||||
[in] | p | (Optional) The number of elements in Alphas array. | ||||||||||
[in] | Betas | (Optional) The parameters of the GARCH(q) component model (starting with the lowest lag). | ||||||||||
[in] | q | (Optional) The number of elements in Betas array. | ||||||||||
[in] | nInnovationType | (Optional) is the probability distribution function of the innovations/residuals (see INNOVATION_TYPE)
| ||||||||||
[in] | nu | (Optional) the shape factor (or degrees of freedom) of the innovations/residuals probability distribution function. | ||||||||||
[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_GARCHM_FORE | ( | double * | pData, |
size_t | nSize, | ||
double * | pVols, | ||
size_t | nVolSize, | ||
double | mu, | ||
double | flambda, | ||
const double * | Alphas, | ||
size_t | p, | ||
const double * | Betas, | ||
size_t | q, | ||
WORD | nInnovationType, | ||
double | nu, | ||
size_t | nSteps, | ||
WORD | retType, | ||
double | alpha, | ||
double * | retVal ) |
Calculates the out-of-sample forecast statistics.
[in] | pData | (Required) The univariate time series data. | ||||||||||||
[in] | nSize | (Required) The number of observations in pData . | ||||||||||||
[in] | pVols | (Required) the univariate time series data (a one dimensional array of cells (e.g. rows or columns)) of the last q realized volatilities. | ||||||||||||
[in] | nVolSize | (Required) the number of elements in sigmas. Only the latest q observations are used. | ||||||||||||
[in] | mu | (Optional) The GARCH model conditional mean (i.e. mu). | ||||||||||||
[in] | flambda | (Optional) The volatility coefficient for the mean. In finance, lambda is referenced as the risk premium. | ||||||||||||
[in] | Alphas | (Optional) The parameters of the ARCH(p) component model (starting with the lowest lag). | ||||||||||||
[in] | p | (Optional) The number of elements in Alphas array. | ||||||||||||
[in] | Betas | (Optional) The parameters of the GARCH(q) component model (starting with the lowest lag). | ||||||||||||
[in] | q | (Optional) The number of elements in Betas array. | ||||||||||||
[in] | nInnovationType | (Optional) is the probability distribution function of the innovations/residuals (see INNOVATION_TYPE)
| ||||||||||||
[in] | nu | (Optional) the shape factor (or degrees of freedom) of the innovations/residuals probability distribution function. | ||||||||||||
[in] | nSteps | (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_GARCHM_GOF | ( | double * | pData, |
size_t | nSize, | ||
double | mu, | ||
double | flambda, | ||
const double * | Alphas, | ||
size_t | p, | ||
const double * | Betas, | ||
size_t | q, | ||
WORD | nInnovationType, | ||
double | nu, | ||
WORD | retType, | ||
double * | retVal ) |
Computes the log-likelihood (LLF), Akaike Information Criterion (AIC) or other goodness of fit functions of the GARCH-M model.
[in] | pData | (Required) The univariate time series data. | ||||||||||||||
[in] | nSize | (Required) The number of observations in pData . | ||||||||||||||
[in] | mu | (Optional) The GARCH model conditional mean (i.e. mu). | ||||||||||||||
[in] | flambda | (Optional) The volatility coefficient for the mean. In finance, lambda is referenced as the risk premium. | ||||||||||||||
[in] | Alphas | (Optional) The parameters of the ARCH(p) component model (starting with the lowest lag). | ||||||||||||||
[in] | p | (Optional) The number of elements in Alphas array. | ||||||||||||||
[in] | Betas | (Optional) The parameters of the GARCH(q) component model (starting with the lowest lag). | ||||||||||||||
[in] | q | (Optional) The number of elements in Betas array. | ||||||||||||||
[in] | nInnovationType | (Optional) is the probability distribution function of the innovations/residuals (see INNOVATION_TYPE)
| ||||||||||||||
[in] | nu | (Optional) the shape factor (or degrees of freedom) of the innovations/residuals probability distribution function. | ||||||||||||||
[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_GARCHM_LRVAR | ( | double | mu, |
double | lambda, | ||
const double * | Alphas, | ||
size_t | p, | ||
const double * | Betas, | ||
size_t | q, | ||
WORD | nInnovationType, | ||
double | nu, | ||
double * | retVal ) |
Calculates the long-run average volatility for the given GARCH model
[in] | mu | (Optional) The GARCH model conditional mean (i.e. mu). | ||||||||
[in] | lambda | (Optional) The volatility coefficient for the mean. In finance, lambda is referenced as the risk premium. | ||||||||
[in] | Alphas | (Optional) The parameters of the ARCH(p) component model (starting with the lowest lag). | ||||||||
[in] | p | (Optional) The number of elements in Alphas array. | ||||||||
[in] | Betas | (Optional) The parameters of the GARCH(q) component model (starting with the lowest lag). | ||||||||
[in] | q | (Optional) The number of elements in Betas array. | ||||||||
[in] | nInnovationType | (Optional) is the probability distribution function of the innovations/residuals (see INNOVATION_TYPE)
| ||||||||
[in] | nu | (Optional) the shape factor (or degrees of freedom) of the innovations/residuals probability distribution function. | ||||||||
[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 |
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_GARCHM_PARAM | ( | double * | pData, |
size_t | nSize, | ||
double * | mu, | ||
double * | flambda, | ||
double * | Alphas, | ||
size_t | p, | ||
double * | Betas, | ||
size_t | q, | ||
WORD | nInnovationType, | ||
double * | nu, | ||
WORD | retType, | ||
size_t | maxIter ) |
Returns the initial (non-optimal), optimal or standard errors of the model's parameters.
[in] | pData | (Required) The univariate time series data. | ||||||||
[in] | nSize | (Required) The number of observations in pData . | ||||||||
[in,out] | mu | (Optional) The GARCH model conditional mean (i.e. mu). | ||||||||
[in,out] | flambda | (Optional) The volatility coefficient for the mean. In finance, lambda is referenced as the risk premium. | ||||||||
[in,out] | Alphas | (Optional) The parameters of the ARCH(p) component model (starting with the lowest lag). | ||||||||
[in] | p | (Optional) The number of elements in Alphas array. | ||||||||
[in,out] | Betas | (Optional) The parameters of the GARCH(q) component model (starting with the lowest lag). | ||||||||
[in] | q | (Optional) The number of elements in Betas array. | ||||||||
[in] | nInnovationType | (Optional) is the probability distribution function of the innovations/residuals (see INNOVATION_TYPE)
| ||||||||
[in,out] | nu | (Optional) the shape factor (or degrees of freedom) of the innovations/residuals probability distribution function. | ||||||||
[in] | retType | (Required) 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_GARCHM_RESID | ( | double * | pData, |
size_t | nSize, | ||
double | mu, | ||
double | flambda, | ||
const double * | Alphas, | ||
size_t | p, | ||
const double * | Betas, | ||
size_t | q, | ||
WORD | nInnovationType, | ||
double | nu, | ||
WORD | retType ) |
Returns an array of cells for the standardized residuals of a given GARCH-M model.
[in,out] | pData | (Required) The univariate time series data. | ||||||||
[in] | nSize | (Required) The number of observations in pData . | ||||||||
[in] | mu | (Optional) The GARCH model conditional mean (i.e. mu). | ||||||||
[in] | flambda | (Optional) The volatility coefficient for the mean. In finance, lambda is referenced as the risk premium. | ||||||||
[in] | Alphas | (Optional) The parameters of the ARCH(p) component model (starting with the lowest lag). | ||||||||
[in] | p | (Optional) The number of elements in Alphas array. | ||||||||
[in] | Betas | (Optional) The parameters of the GARCH(q) component model (starting with the lowest lag). | ||||||||
[in] | q | (Optional) The number of elements in Betas array. | ||||||||
[in] | nInnovationType | (Optional) is the probability distribution function of the innovations/residuals (see INNOVATION_TYPE)
| ||||||||
[in] | nu | (Optional) the shape factor (or degrees of freedom) of the innovations/residuals probability distribution function. | ||||||||
[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.Requirement | Value |
---|---|
Target Platform | Windows |
Header | SFSDK.h (include Windows.h) |
Library | SFSDK.lib |
DLL | SFSDK.dll SFLUC.dll SFLOG.dll |
int __stdcall NDK_GARCHM_SIM | ( | double | mu, |
double | flambda, | ||
const double * | Alphas, | ||
size_t | p, | ||
const double * | Betas, | ||
size_t | q, | ||
WORD | nInnovationType, | ||
double | nu, | ||
double * | pData, | ||
size_t | nSize, | ||
double * | pSigmas, | ||
size_t | nSigmaSize, | ||
UINT | nSeed, | ||
double * | retArray, | ||
size_t | nSteps ) |
Returns a simulated data series the underlying GARCH process.
[in] | mu | (Optional) The GARCH model conditional mean (i.e. mu). | ||||||||
[in] | flambda | (Optional) The volatility coefficient for the mean. In finance, lambda is referenced as the risk premium. | ||||||||
[in] | Alphas | (Optional) The parameters of the ARCH(p) component model (starting with the lowest lag). | ||||||||
[in] | p | (Optional) The number of elements in Alphas array. | ||||||||
[in] | Betas | (Optional) The parameters of the GARCH(q) component model (starting with the lowest lag). | ||||||||
[in] | q | (Optional) The number of elements in Betas array. | ||||||||
[in] | nInnovationType | (Optional) is the probability distribution function of the innovations/residuals (see INNOVATION_TYPE)
| ||||||||
[in] | nu | (Optional) the shape factor (or degrees of freedom) of the innovations/residuals probability distribution function. | ||||||||
[in] | pData | (Optional) he univariate time series of the latest observations (a one dimensional array). | ||||||||
[in] | nSize | (Required) The number of observations in pData . | ||||||||
[in] | pSigmas | (Optional) The univariate time series of the latest observations (a one dimensional array). | ||||||||
[in] | nSigmaSize | (Required) The number of observations in pSigmas . | ||||||||
[in] | nSeed | (Required) is an unsigned integer for setting up the random number generators. | ||||||||
[out] | retArray | (Required) is the calculated simulation value. | ||||||||
[in] | nSteps | (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_GARCHM_VALIDATE | ( | double | mu, |
double | lambda, | ||
const double * | Alphas, | ||
size_t | p, | ||
const double * | Betas, | ||
size_t | q, | ||
WORD | nInnovationType, | ||
double | nu ) |
Examines the model's parameters for stability constraints (e.g. variance stationary, positive variance, etc.).
[in] | mu | (Optional) The GARCH model conditional mean (i.e. mu). | ||||||||
[in] | lambda | (Optional) The volatility coefficient for the mean. In finance, lambda is referenced as the risk premium. | ||||||||
[in] | Alphas | (Optional) The parameters of the ARCH(p) component model (starting with the lowest lag). | ||||||||
[in] | p | (Optional) The number of elements in Alphas array. | ||||||||
[in] | Betas | (Optional) The parameters of the GARCH(q) component model (starting with the lowest lag). | ||||||||
[in] | q | (Optional) The number of elements in Betas array. | ||||||||
[in] | nInnovationType | (Optional) is the probability distribution function of the innovations/residuals (see INNOVATION_TYPE)
| ||||||||
[in] | nu | (Optional) the shape factor (or degrees of freedom) of the innovations/residuals probability distribution function. |
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 |