Do you have an idea whether it is possible to define the conditional variance of an endogenous variable (say x_t) within a model in DYNARE. In particular, I have empirical data on the conditional variance of output-gap-growth and would like to use it as an observable for a Bayesian estimation. The model is solved with second order approximation. Concretely, if x_t is the growth of the output gap, I’d like to have a new variable “CV” corresponding to the conditional variance

but it seems to be a constant. Is the specification of CV wrong? Note, that the model is a replication of the New-Keynesian-Vulnerability (NKV) by Adrian et al (2020), where one of the shocks is assumed to have conditional heteroscedasticity. I.e., there is a shock with a time varying standard deviation V(X), where the function V(X) depends on endogenous and exogenous state variables.

The MOD-File is attached. I’m happy to provide further information on the model.

I have implemented the conditional variance. As in Adrian et al (2020), I first linearized my model and then added a term that is multiplied by the demand shock. This term consists of endogenous state variables. This makes the model linear-quadratic. Estimating order one without this quadratic term worked well. However, when I try to estimate the model with higher order approximations and the quadratic term, I keep running into the same error:

ESTIMATION_CHECKS: There was an error in computing the likelihood for initial parameter values.
ESTIMATION_CHECKS: If this is not a problem with the setting of options (check the error message below),
ESTIMATION_CHECKS: you should try using the calibrated version of the model as starting values. To do
ESTIMATION_CHECKS: this, add an empty estimated_params_init-block with use_calibration option immediately before the estimation
ESTIMATION_CHECKS: command (and after the estimated_params-block so that it does not get overwritten):
Error using chol
Matrix must be positive definite.
(...)

I tried different specifications, but I could not solve the problem. Sometimes the kernel density maximization started but stopped after one iteration.

Please find the .mod file and data attached. I would be grateful if you could take a look at it. Particle Filter.zip (43.6 KB)

The problem is that your using order=3 with the particle filter, which relies on simulations. These simulations can be explosive unless pruning is used. However, the particle filter routines in Dynare currently do not allow for pruning at order=3.