📄 mrw_predic.h
字号:
/* Mean and variance of Log(X) where X is a normalized Gaussian */#define MEAN_LOG_GAUSS (-1.27/2)#define VAR_LOG_GAUSS (M_PI*M_PI/8) //// Procedure to compute the theoretical mean of the magnitude LnSqrtVol_m//extern LWFLOAT MeanLnSqrtVol(LWFLOAT m, LWFLOAT lambda2, LWFLOAT sigma2, LWFLOAT T);//// Procedure to compute the theoretical mean of Ln(X_m)//extern LWFLOAT MeanLnX(LWFLOAT m, LWFLOAT lambda2, LWFLOAT sigma2, LWFLOAT T);//// Procedure to compute the theoretical mean of SqrtVol_m//extern LWFLOAT MeanSqrtVol(LWFLOAT m, LWFLOAT lambda2, LWFLOAT sigma2, LWFLOAT T); // Procedure to compute the theoretical mean of |epsilon|extern LWFLOAT MeanAbsEps();// Procedure to compute the theoretical mean of |X_m|extern LWFLOAT MeanAbsX(LWFLOAT m, LWFLOAT lambda2, LWFLOAT sigma2, LWFLOAT T); //// Procedure to compute the theoretical covariance function of the magnitude LnSqrtVol_m1 with LnSqrtVol_m2 for any m1 and m2//extern LWFLOAT CovLnSqrtVol (int m1, int n1, int m2, int n2, LWFLOAT lambda2, LWFLOAT T);//// Compute the variance of the LnSqrtVol//extern LWFLOAT VarLnSqrtVol(int m, LWFLOAT lambda2, LWFLOAT T);//// Procedure to compute the theoretical auto covariance function of Ln(X_m)//extern LWFLOAT CovLnX (int n, int m, LWFLOAT lambda2, LWFLOAT T);//// Procedure to compute the theoretical covariance of the SqrtVol_m : Cov(SqrtVol_m1[n1],SqrtVol_m1[n2])//extern LWFLOAT CovSqrtVol(LWFLOAT m1, int n1, LWFLOAT m2, int n2, LWFLOAT lambda2, LWFLOAT sigma2, LWFLOAT T);//// Procedure to compute the theoretical auto covariance function of |X_m|//extern LWFLOAT CovAbsX (int n, int m, LWFLOAT lambda2, LWFLOAT T, LWFLOAT sigma2);//// Procedure to compute the theoretical mean of Vol_m//extern LWFLOAT MeanVol(LWFLOAT m, LWFLOAT lambda2, LWFLOAT sigma2, LWFLOAT T) ;//// Procedure to compute the theoretical covariance of the Vol_m : Cov(Vol_m1[n1],Vol_m1[n2])//extern LWFLOAT CovVol(LWFLOAT m1, int n1, LWFLOAT m2, int n2, LWFLOAT lambda2, LWFLOAT sigma2, LWFLOAT T); //// Procedure to compute the theoretical auto covariance function of |X_m|^2//extern LWFLOAT CovX2 (int n, int m, LWFLOAT lambda2, LWFLOAT T, LWFLOAT sigma2);/****************************************************************************************************************//* * Log prediction *//****************************************************************************************************************///// The filter that is used for the prediction/estimation is the linear regression filter //// for predicting LnSqrtVol_m2[h]// from LnRet_m1[n] for (n <= 0)//// A filter of size NF is returned as well as the estimated variance (var)//extern SIGNAL ComputeFilterLog(int m1, int m2, int h, int d, LWFLOAT T, LWFLOAT lambda2, int NF, char flagNoise, LWFLOAT *var);//// Prediction of one value of LnSqrtVol_m2[n+h-m2], given {LnX_m1[n-d-m1-k]} or {LnSqrtVol_m1[n-d-m1-k]} for k >= 0//extern LWFLOAT PredLogSqrtVol1(SIGNAL lnRet, SIGNAL filter, int N, int m1, int m2, int d, LWFLOAT lambda2, LWFLOAT sigma2, LWFLOAT T, char flagNoise);//// Get the formula when a single point update is necessary : two unknown mag and cvol//// prediction = a*mag + b*ln(c+cvol) + d //extern void PredLogSqrtVol1GetFormula(SIGNAL input, SIGNAL filter, int n, int m1, int m2, int delay, LWFLOAT lambda2, LWFLOAT sigma2, LWFLOAT T, char flagNoise, LWFLOAT *a, LWFLOAT *b, LWFLOAT *c, LWFLOAT *d);//// For all current time n >= N : //// Prediction of LnSqrtVol_m2[n+h-m2], given {LnX_m1[n-d-m1-k]} or {LnSqrtVol_m1[n-d-m1-k]} for k >= 0 //extern SIGNAL PredLogSqrtVol(SIGNAL lnRet, SIGNAL filter, int N, int m1, int m2, int d, LWFLOAT lambda2, LWFLOAT T, char flagNoise);//// Get the VaR of level p of the random variable epsilon*exp(omega) where epsilon is N(0,1) and omega is N(mean,variance)//extern LWFLOAT GetLogNormalVaR(LWFLOAT mean, LWFLOAT variance, LWFLOAT p);//// Compute Likelihood Prob(epsilon*exp(Omega) = z)// where // Omega is gaussian N(Omu,Ovar)// epsilon is gaussian N(Emu,Evar)//extern LWFLOAT EspilonExpOmegaLikelihood(LWFLOAT z, LWFLOAT Emu, LWFLOAT Evar, LWFLOAT Omu, LWFLOAT Ovar);// // Get the probability Prob(z > epsilon exp(omega))//extern LWFLOAT GetProb(LWFLOAT z, LWFLOAT omMean, LWFLOAT omVar);/****************************************************************************************************************//* * Sq prediction *//****************************************************************************************************************///// The filter that is used for the prediction/estimation is the linear regression filter //// for predicting Vol_m2[h]// from |X_m1[n]|^2 for (n <= 0)//// A filter of size NF is returned as well as the estimated variance (var)//extern SIGNAL ComputeFilterSq(int m1, int m2, int h, int d, LWFLOAT T, LWFLOAT lambda2, LWFLOAT sigma2, int NF, char flagNoise, LWFLOAT *var);//// Prediction of one value of Vol_m2[n+h-m2], given {X_m1[n-d-m1-k]} or {SqrtVol_m1[n-d-m1-k]} for k >= 0//extern LWFLOAT PredSqVol1(SIGNAL lnRet, SIGNAL filter, int N, int m1, int m2, int d, LWFLOAT lambda2, LWFLOAT sigma2, LWFLOAT T, char flagNoise);//// For all current time n >= N : //// Prediction of Vol_m2[n+h-m2], given {X_m1[n-d-m1-k]} or {SqrtVol_m1[n-d-m1-k]} for k >= 0 //extern SIGNAL PredSqVol(SIGNAL lnRet, SIGNAL filter, int N, int m1, int m2, int d, LWFLOAT lambda2, LWFLOAT T, char flagNoise);/****************************************************************************************************************//* * Lin prediction *//****************************************************************************************************************///// The filter that is used for the prediction/estimation is the linear regression filter //// for predicting SqrtVol_m2[h]// from |X_m1[n]| for (n <= 0)//// A filter of size NF is returned as well as the estimated variance (var)//extern SIGNAL ComputeFilterLin(int m1, int m2, int h, int d, LWFLOAT T, LWFLOAT lambda2, LWFLOAT sigma2, int NF, char flagNoise, LWFLOAT *var);//// Prediction of one value of SqrtVol_m2[n+h-m2], given {X_m1[n-d-m1-k]} or {SqrtVol_m1[n-d-m1-k]} for k >= 0//extern LWFLOAT PredLinSqrtVol1(SIGNAL lnRet, SIGNAL filter, int N, int m1, int m2, int d, LWFLOAT lambda2, LWFLOAT sigma2, LWFLOAT T, char flagNoise);//// For all current time n >= N : //// Prediction of SqrtVol_m2[n+h-m2], given {X_m1[n-d-m1-k]} or {SqrtVol_m1[n-d-m1-k]} for k >= 0 //extern SIGNAL PredLinSqrtVol(SIGNAL lnRet, SIGNAL filter, int N, int m1, int m2, int d, LWFLOAT lambda2, LWFLOAT T, char flagNoise);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -