The model with state dependent conditional heteroskedasticity

The structural shock follows stationary first order autoregressive processes, driven by conditionally normally distributed heteroskedastic innovation, specifically,

The consumption lnHatvC shock follows stationary first order autoregressive processes driven by conditionally normally distributed heteroskedastic innovations:

lnHatvC    = rhoC*lnHatvC(-1) + epswC     %epswC  N(0,Hat_hc)

The conditional variances of the consumption Hat_hc shock are loglinear functions of the past changes in and levels of the domestic and foreign output gaps:

ln(Hat_hc) = ln(HatSigmaC^2) -  lamM*(psideltY*deltaln*Hat*YGf(-1) -psiY*ln(HatYGf_obs(-1))) -(1-lamM)*(psideltY*deltaln*Hat*YG(-1) -psiY*ln(HatYG_obs(-1)));  % HatSigmaC N(0,HatSigmaC^2)

Here is the specific implementation form I used in Dynare:

lnHatvC  = rhoC*lnHatvC(-1) + exp(lnHat_hc)
lnHat_hc = ln(HatSigmaC^2) -  lamM*(psideltY*deltaln*Hat*YGf(-1) -psiY*ln(HatYGf_obs(-1))) -(1-lamM)*(psideltY*deltaln*Hat*YG(-1) -psiY*ln(HatYG_obs(-1)));

When running the model in Dynare, the following error message appears:

Error using chol: The matrix must be positive definite. (Error in gmhmaxlik_core at line 194)?
The matrix must be positive definite.

error gmhmaxlik_core (line 194)
dd = transpose(chol(CovJump));
error gmhmaxlik (line 100)
[PostMode, PostVariance, Scale, PostMean] = gmhmaxlik_core(fun, OldPostMode, bounds, gmhmaxlikOptions, Scale, flag, MeanPar, OldPostVariance, varargin{:});
error dynare_minimize_objective (line 336)
[opt_par_values, hessian_mat, Scale, fval] = gmhmaxlik(objective_function, start_par_value, …
error dynare_estimation_1 (line 221)
[xparam1, fval, exitflag, hh, options_, Scale, new_rat_hess_info] =
dynare_minimize_objective(objective_function,xparam1,options_.mode_compute,options_,[bounds.lb
bounds.ub],bayestopt_.name,bayestopt_,hh,dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,bounds,oo_);
error dynare_estimation (line 118)
dynare_estimation_1(var_list,dname);
error msDSGEPF.driver (line 2017)
oo_recursive_=dynare_estimation(var_list_);
error dynare (line 278)
evalin(‘base’,[fname ‘.driver’]);

To identify the cause of the issue, I tried the following simple form, and the model runs successfully:

lnHatvC    = rhoC*lnHatvC(-1) + HatSigmaC^2

**I have two questions to seek expert guidance on:

  1. What might be the possible reasons for this error message: “Error using chol: The matrix must be positive definite”?
  2. The model incorporates state-dependent conditional heteroskedasticity, where the conditional heteroskedasticity is calculated by additional equations. How should such a model be implemented in Dynare? Are there any similar examples of im
    plementation in Dynare?

I would greatly appreciate any guidance from the experts. Thank you in advance!

Without the codes it is impossible to tell. But the type of model looks very much like a model from the uncertainty literature. Generally, uncertainty shock models can only be solved at third-order for shocks to the variance have an independent effect. That would also mean you cannot estimate the model using the Kalman filter at order=1.

I have no idea if I estimate the model using the Kalman filter at order=1, I use the estimation command as the follow:

@#if NONLINEAR_KALMAN_BM
use_univariate_filters_if_singularity_is_detected = 0;
estimation(
datafile=Estimation_Indicator,xls_sheet=Estimation_Indicator_Kor_ln, % data file
mh_replic=2100, %
lik_init=2, kalman_algo=2, %
mode_compute=6, %
mh_nblocks = 20, %
mode_check,
selected_variables_only,
cova_compute =0, %
nonlinear_filter_initialization=3, %
logdata,
nodisplay,
plot_priors =0
) Y_obs PC_obs AB_obs VH_obs VF_obs UL_obs CappiC CapgAT CapCU;
@#endif

The code has been sent to you, and I would appreciate it if you could take a look at it for me

That command does not go to order=2 or order=3. It will use the standard Kalman filter.

I see, thanks a lot professor

professor jpfeifer
First, I want to thank you for your continued guidance and support, which has allowed my research to progress in depth.
Here, I’ve encountered an issue whose root cause I haven’t yet identified, and I haven’t come up with a solution. I’d really appreciate your advice. Thank you in advance!

…
There are 42 eigenvalue(s) larger than 1 in modulus
for 42 forward-looking variable(s)

The rank condition is verified.

Estimation using a non linear filter!

警告: initial_estimation_checks:: the pruning settings differ between the particle filter and the one used for IRFs/simulations. Make sure this is intended.

> In initial_estimation_checks (line 75)
> In dynare_estimation_1 (line 159)
> In dynare_estimation (line 118)
> In msDSGEPF.driver (line 2051)
> In dynare (line 278)
> 警告: Your prior allows for negative standard deviations for structural shocks. Due to working with variances, Dynare will be able to continue, but it is recommended to change your
> prior.
> In initial_estimation_checks (line 190)
> In dynare_estimation_1 (line 159)
> In dynare_estimation (line 118)
> In msDSGEPF.driver (line 2051)
> In dynare (line 278)
> Initial value of the log posterior (or likelihood): -75891770702.6392
> 警告: MATLAB 已通过改用 OpenGL 软件禁用了某些高级的图形渲染功能。欲了解有关详细信息,请点击此处。

# ==========================================================
Change in the posterior covariance matrix = 1.
Change in the posterior mean = 0.
Current mode = 75891770702.6392
Mode improvement = 0
New value of jscale = 0

# ==========================================================
Change in the posterior covariance matrix = 0.
Change in the posterior mean = 0.
Current mode = 75891770702.6392
Mode improvement = 0
New value of jscale = 0

# ==========================================================
Change in the posterior covariance matrix = 0.
Change in the posterior mean = 0.
Current mode = 75891770702.6392
Mode improvement = 0
New value of jscale = 0

警告: 矩阵为奇异工作精度。

> In gmhmaxlik (line 117)
> In dynare_minimize_objective (line 336)
> In dynare_estimation_1 (line 221)
> In dynare_estimation (line 118)
> In msDSGEPF.driver (line 2051)
> In dynare (line 278)

Optimal value of the scale parameter = 0

Final value of minus the log posterior (or likelihood):75891770702.639160

POSTERIOR KERNEL OPTIMIZATION PROBLEM!
(minus) the hessian matrix at the “mode” is not positive definite!
=> posterior variance of the estimated parameters are not positive.
You should try to change the initial values of the parameters using
the estimated_params_init block, or use another optimization routine.

The following parameters are at the prior bound: SE_CapSigmaA, SE_CapSigmaN, SE_CapSigmaC, SE_CapSigmaI, SE_CapSigmaX, SE_CapSigmaM, SE_CapSigmaB, SE_CapSigmaH, SE_CapSigmaS, SE_CapSigmaepsw, SE_CapSigmaThetaY, SE_CapSigmaThetaL, SE_CapSigmaiB, SE_CapSigmaP, SE_CapSigmaG, SE_CapSigmaphi, SE_barSigmaPY, SE_barSigmaY, SE_barSigmaPC, SE_barSigmaC, SE_barSigmaI, SE_barSigmaX, SE_barSigmaM, SE_barSigmaVH, SE_barSigmaVF, SE_barSigmaAB, SE_barSigmaEPSW, SE_barSigmaW, SE_barSigmaL, SE_barSigmaiB, SE_barSigmaiG, SE_barSigmaUL, SE_EOBS_CapPY
Some potential solutions are:

* Check your model for mistakes.
* Check whether model and data are consistent (correct observation equation).
* Shut off prior_trunc.
* Change the optimization bounds.
* Use a different mode_compute like 6 or 9.
* Check whether the parameters estimated are identified.
* Check prior shape (e.g. Inf density at bound(s)).
* Increase the informativeness of the prior.
  警告: The results below are most likely wrong!

> In dynare_estimation_1 (line 318)
> In dynare_estimation (line 118)
> In msDSGEPF.driver (line 2051)
> In dynare (line 278)
> 
> 
> initial value for 
> “SE_CapSigmaA, SE_CapSigmaN, SE_CapSigmaC, SE_CapSigmaI, SE_CapSigmaX, SE_CapSigmaM, SE_CapSigmaB, SE_CapSigmaH, SE_CapSigmaS, SE_CapSigmaepsw, SE_CapSigmaThetaY, SE_CapSigmaThetaL, SE_CapSigmaiB, SE_CapSigmaP, SE_CapSigmaG, SE_CapSigmaphi, SE_barSigmaPY, SE_barSigmaY, SE_barSigmaPC, SE_barSigmaC, SE_barSigmaI, SE_barSigmaX, SE_barSigmaM, SE_barSigmaVH, SE_barSigmaVF, SE_barSigmaAB, SE_barSigmaEPSW, SE_barSigmaW, SE_barSigmaL, SE_barSigmaiB, SE_barSigmaiG, SE_barSigmaUL, SE_EOBS_CapPY“
> 
> stderr CapSigmaA,1,0,1,normal_pdf,1,0.1;
> …

Without codes it is impossible to tell.