Statistics and time-series analytics API

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)
 
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)
 
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)
 
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 *sigmas, size_t nSigmaSize, UINT nSeed, double *retArray, size_t nSteps)
 
int __stdcall NDK_GARCHM_FORE (double *pData, size_t nSize, double *sigmas, size_t nSigmaSize, double mu, double flambda, const double *Alphas, size_t p, const double *Betas, size_t q, WORD nInnovationType, double nu, size_t nStep, WORD retType, double alpha, double *retVal)
 
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)
 
int __stdcall NDK_GARCHM_LRVAR (double mu, double flambda, const double *Alphas, size_t p, const double *Betas, size_t q, WORD nInnovationType, double nu, double *retVal)
 
int __stdcall NDK_GARCHM_VALIDATE (double mu, double flambda, const double *Alphas, size_t p, const double *Betas, size_t q, WORD nInnovationType, double nu)
 

Detailed Description

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.

Function Documentation

◆ NDK_GARCHM_FITTED()

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)

Note
1. The time series is homogeneous or equally spaced
2. The time series may include missing values (e.g. NaN) at either end.
3. The number of parameters in the input argument - alpha - determines the order of the ARCH component model.
4. The number of parameters in the input argument - beta - determines the order of the GARCH component model
Returns
status code of the operation
Return values
NDK_SUCCESSOperation successful
NDK_FAILEDoperation is unsuccessful ( )
See also
NDK_GARCHM_GOF(), NDK_GARCHM_RESID(), NDK_GARCHM_PARAM(), NDK_GARCHM_FORE(), NDK_GARCHM_VALIDATE()
Parameters
[in]pDatais the univariate time series data (a one dimensional array).
[in]nSizeis the number of observations in X.
[in]muis the GARCH model conditional mean (i.e. mu).
[in]flambdais the volatility coefficient for the mean. In finance, lambda is referenced as the risk premium.
[in]Alphasare the parameters of the ARCH(p) component model (starting with the lowest lag).
[in]pis the number of elements in Alphas array
[in]Betasare the parameters of the GARCH(q) component model (starting with the lowest lag).
[in]qis the number of elements in Betas array
[in]nInnovationTypeis the probability distribution function of the innovations/residuals (see INNOVATION_TYPE)
  • INNOVATION_GAUSSIAN Gaussian Distribution (default)
  • INNOVATION_TDIST Student's T-Distribution,
  • INNOVATION_GED Generalized Error Distribution (GED)
[in]nuis the shape factor (or degrees of freedom) of the innovations/residuals probability distribution function.
[in]retTypeis a switch to select a output type ( see FIT_RETVAL_FUNC)

◆ NDK_GARCHM_FORE()

int __stdcall NDK_GARCHM_FORE ( double * pData,
size_t nSize,
double * sigmas,
size_t nSigmaSize,
double mu,
double flambda,
const double * Alphas,
size_t p,
const double * Betas,
size_t q,
WORD nInnovationType,
double nu,
size_t nStep,
WORD retType,
double alpha,
double * retVal )

Calculates the out-of-sample forecast statistics.

Note
1. The time series is homogeneous or equally spaced
2. The time series may include missing values (e.g. NaN) at either end.
3. The number of parameters in the input argument - alpha - determines the order of the ARCH component model.
4. The number of parameters in the input argument - beta - determines the order of the GARCH component model
Returns
status code of the operation
Return values
NDK_SUCCESSOperation successful
NDK_FAILEDoperation is unsuccessful ( )
See also
NDK_GARCH_GOF(), NDK_GARCH_RESID(), NDK_GARCH_PARAM(), NDK_GARCH_FITTED(), NDK_GARCH_VALIDATE()
Parameters
[in]pDatais the univariate time series data (a one dimensional array).
[in]nSizeis the number of observations in X.
[in]sigmasis the univariate time series data (a one dimensional array of cells (e.g. rows or columns)) of the last q realized volatilities.
[in]nSigmaSizeis the number of elements in sigmas. Only the latest q observations are used.
[in]muis the GARCH model conditional mean (i.e. mu).
[in]flambdais the volatility coefficient for the mean. In finance, lambda is referenced as the risk premium.
[in]Alphasare the parameters of the ARCH(p) component model (starting with the lowest lag).
[in]pis the number of elements in Alphas array
[in]Betasare the parameters of the GARCH(q) component model (starting with the lowest lag).
[in]qis the number of elements in Betas array
[in]nInnovationTypeis the probability distribution function of the innovations/residuals (see INNOVATION_TYPE)
  • INNOVATION_GAUSSIAN Gaussian or Normal Distribution
  • INNOVATION_TDIST Student's T-Distribution,
  • INNOVATION_GED Generalized Error Distribution (GED)
[in]nuis the shape factor (or degrees of freedom) of the innovations/residuals probability distribution function.
[in]nStepis the forecast time/horizon (expressed in terms of steps beyond end of the time series).
[in]retTypeis a switch to select the type of value returned
  1. Mean forecast
  2. Forecast Error
  3. Volatility term structure
  4. Confidence interval lower limit
  5. Confidence interval upper limit (see FORECAST_RETVAL_FUNC)
[in]alphais the statistical significance level. If missing, a default of 5% is assumed.
[out]retValis the calculated forecast value

◆ NDK_GARCHM_GOF()

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 function of the GARCH model.

Note
1. The time series is homogeneous or equally spaced
2. The time series may include missing values (e.g. NaN) at either end.
3. The number of parameters in the input argument - alpha - determines the order of the ARCH component model.
4. The number of parameters in the input argument - beta - determines the order of the GARCH component model
Returns
status code of the operation
Return values
NDK_SUCCESSOperation successful
NDK_FAILEDoperation is unsuccessful ( )
See also
NDK_GARCHM_RESID(), NDK_GARCHM_PARAM(), NDK_GARCHM_FORE(), NDK_GARCHM_FITTED(), NDK_GARCHM_VALIDATE()
Parameters
[in]pDatais the univariate time series data (a one dimensional array).
[in]nSizeis the number of observations in X.
[in]muis the GARCH model conditional mean (i.e. mu).
[in]flambdais the volatility coefficient for the mean. In finance, lambda is referenced as the risk premium.
[in]Alphasare the parameters of the ARCH(p) component model (starting with the lowest lag).
[in]pis the number of elements in Alphas array
[in]Betasare the parameters of the GARCH(q) component model (starting with the lowest lag).
[in]qis the number of elements in Betas array
[in]nInnovationTypeis the probability distribution function of the innovations/residuals (see INNOVATION_TYPE)
  • INNOVATION_GAUSSIAN Gaussian Distribution (default)
  • INNOVATION_TDIST Student's T-Distribution,
  • INNOVATION_GED Generalized Error Distribution (GED)
[in]nuis the shape factor (or degrees of freedom) of the innovations/residuals probability distribution function.
[in]retTypeis a switch to select a fitness measure ( see GOODNESS_OF_FIT_FUNC)
[out]retValis the calculated goodness of fit value.

◆ NDK_GARCHM_LRVAR()

int __stdcall NDK_GARCHM_LRVAR ( double mu,
double flambda,
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-M model

Note
1. The time series is homogeneous or equally spaced
2. The time series may include missing values (e.g. NaN) at either end.
3. The number of parameters in the input argument - alpha - determines the order of the ARCH component model.
4. The number of parameters in the input argument - beta - determines the order of the GARCH component model
Returns
status code of the operation
Return values
NDK_SUCCESSOperation successful
NDK_FAILEDoperation is unsuccessful ( )
See also
NDK_GARCH_GOF(), NDK_GARCH_RESID(), NDK_GARCH_PARAM(), NDK_GARCH_FORE(), NDK_GARCH_VALIDATE()
Parameters
[in]muis the GARCH model conditional mean (i.e. mu).
[in]flambdais the volatility coefficient for the mean. In finance, lambda is referenced as the risk premium.
[in]Alphasare the parameters of the ARCH(p) component model (starting with the lowest lag).
[in]pis the number of elements in Alphas array
[in]Betasare the parameters of the GARCH(q) component model (starting with the lowest lag).
[in]qis the number of elements in Betas array
[in]nInnovationTypeis the probability distribution function of the innovations/residuals (see INNOVATION_TYPE)
  • INNOVATION_GAUSSIAN Gaussian Distribution (default)
  • INNOVATION_TDIST Student's T-Distribution,
  • INNOVATION_GED Generalized Error Distribution (GED)
[in]nuis the shape factor (or degrees of freedom) of the innovations/residuals probability distribution function.
[out]retValis the calculated long run value

◆ NDK_GARCHM_PARAM()

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 an array of cells for the initial (non-optimal), optimal or standard errors of the model's parameters.

Note
1. The time series is homogeneous or equally spaced
2. The time series may include missing values (e.g. NaN) at either end.
3. The number of parameters in the input argument - alpha - determines the order of the ARCH component model.
4. The number of parameters in the input argument - beta - determines the order of the GARCH component model
Returns
status code of the operation
Return values
NDK_SUCCESSOperation successful
NDK_FAILEDoperation is unsuccessful ( )
See also
NDK_GARCH_GOF(), NDK_GARCH_RESID(), NDK_GARCH_FORE(), NDK_GARCH_FITTED(), NDK_GARCH_VALIDATE()
Parameters
[in]pDatais the univariate time series data (a one dimensional array).
[in]nSizeis the number of observations in X.
mu[inout] is the GARCH model conditional mean (i.e. mu).
flambda[inout] is the volatility coefficient for the mean. In finance, lambda is referenced as the risk premium.
Alphas[inout] are the parameters of the ARCH(p) component model (starting with the lowest lag).
[in]pis the number of elements in Alphas array
Betas[inout] are the parameters of the GARCH(q) component model (starting with the lowest lag).
[in]qis the number of elements in Betas array
[in]nInnovationTypeis the probability distribution function of the innovations/residuals (see INNOVATION_TYPE)
  • INNOVATION_GAUSSIAN Gaussian Distribution (default)
  • INNOVATION_TDIST Student's T-Distribution,
  • INNOVATION_GED Generalized Error Distribution (GED)
nu[inout] is the shape factor (or degrees of freedom) of the innovations/residuals probability distribution function.
[in]retTypeis a switch to select the type of value returned: 1= Quick Guess, 2=Calibrated, 3= Std. Errors ( see MODEL_RETVAL_FUNC)
[in]maxIteris the maximum number of iterations used to calibrate the model. If missing or less than 100, the default maximum of 100 is assumed.

◆ NDK_GARCHM_RESID()

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 model

Note
1. The time series is homogeneous or equally spaced
2. The time series may include missing values (e.g. NaN) at either end.
3. The number of parameters in the input argument - alpha - determines the order of the ARCH component model.
4. The number of parameters in the input argument - beta - determines the order of the GARCH component model
Returns
status code of the operation
Return values
NDK_SUCCESSOperation successful
NDK_FAILEDoperation is unsuccessful ( )
Deprecated
this function is being replaced by NDK_GARCHM_FITTED()
See also
NDK_GARCHM_GOF(), NDK_GARCH_PARAM(), NDK_GARCH_FORE(), NDK_GARCH_FITTED(), NDK_GARCH_VALIDATE()
Parameters
[in]pDatais the univariate time series data (a one dimensional array).
[in]nSizeis the number of observations in X.
[in]muis the GARCH model conditional mean (i.e. mu).
[in]flambdais the volatility coefficient for the mean. In finance, lambda is referenced as the risk premium.
[in]Alphasare the parameters of the ARCH(p) component model (starting with the lowest lag).
[in]pis the number of elements in Alphas array
[in]Betasare the parameters of the GARCH(q) component model (starting with the lowest lag).
[in]qis the number of elements in Betas array
[in]nInnovationTypeis the probability distribution function of the innovations/residuals (see INNOVATION_TYPE)
  • INNOVATION_GAUSSIAN Gaussian Distribution (default)
  • INNOVATION_TDIST Student's T-Distribution,
  • INNOVATION_GED Generalized Error Distribution (GED)
[in]nuis the shape factor (or degrees of freedom) of the innovations/residuals probability distribution function.
[in]retTypeis a switch to select a residuals-type:raw or standardized. see RESID_RETVAL_FUNC

◆ NDK_GARCHM_SIM()

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 * sigmas,
size_t nSigmaSize,
UINT nSeed,
double * retArray,
size_t nSteps )

Returns a simulated data series the underlying GARCH process.

Note
1. The time series is homogeneous or equally spaced
2. The time series may include missing values (e.g. NaN) at either end.
3. The number of parameters in the input argument - alpha - determines the order of the ARCH component model.
4. The number of parameters in the input argument - beta - determines the order of the GARCH component model
Returns
status code of the operation
Return values
NDK_SUCCESSOperation successful
NDK_FAILEDoperation is unsuccessful ( )
See also
NDK_GARCH_RESID(), NDK_GARCH_PARAM(), NDK_GARCH_FORE(), NDK_GARCH_FITTED(), NDK_GARCH_VALIDATE()
Parameters
[in]muis the GARCH model conditional mean (i.e. mu).
[in]flambdais the volatility coefficient for the mean. In finance, lambda is referenced as the risk premium.
[in]Alphasare the parameters of the ARCH(p) component model (starting with the lowest lag).
[in]pis the number of elements in Alphas array
[in]Betasare the parameters of the GARCH(q) component model (starting with the lowest lag).
[in]qis the number of elements in Betas array
[in]nInnovationTypeis the probability distribution function of the innovations/residuals (see INNOVATION_TYPE)
[in]nuis the shape factor (or degrees of freedom) of the innovations/residuals probability distribution function.
[in]pDatais the univariate time series data (a one dimensional array).
[in]nSizeis the number of observations in X.
[in]sigmasis the univariate time series data (a one dimensional array of cells (e.g. rows or columns)) of the last q realized volatilities.
[in]nSigmaSizeis the number of elements in sigmas. Only the latest q observations are used.
[in]nSeedis an unsigned integer for setting up the random number generators
[out]retArrayis the calculated simulation value
[in]nStepsis the number of future steps to simulate for.

◆ NDK_GARCHM_VALIDATE()

int __stdcall NDK_GARCHM_VALIDATE ( double mu,
double flambda,
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.).

Note
1. The time series is homogeneous or equally spaced
2. The time series may include missing values (e.g. NaN) at either end.
3. The number of parameters in the input argument - alpha - determines the order of the ARCH component model.
4. The number of parameters in the input argument - beta - determines the order of the GARCH component model
Returns
status code of the operation
Return values
NDK_SUCCESSOperation successful
NDK_FAILEDoperation is unsuccessful ( )
See also
NDK_GARCHM_GOF(), NDK_ARCHM_RESID(), NDK_ARCHM_PARAM(), NDK_ARCHM_FORE(), NDK_ARCHM_FITTED()
Parameters
[in]muis the GARCH model conditional mean (i.e. mu).
[in]flambdais the volatility coefficient for the mean. In finance, lambda is referenced as the risk premium.
[in]Alphasare the parameters of the ARCH(p) component model (starting with the lowest lag).
[in]pis the number of elements in Alphas array
[in]Betasare the parameters of the GARCH(q) component model (starting with the lowest lag).
[in]qis the number of elements in Betas array
[in]nInnovationTypeis the probability distribution function of the innovations/residuals (see INNOVATION_TYPE)
  • INNOVATION_GAUSSIAN Gaussian Distribution (default)
  • INNOVATION_TDIST Student's T-Distribution,
  • INNOVATION_GED Generalized Error Distribution (GED)
[in]nuis the shape factor (or degrees of freedom) of the innovations/residuals probability distribution function.