One-step HP-filter estimation inside DSGE

Hello everyone,

I’m trying to replicate what Ferroni (2001) “Trend Agnostic One-Step Estimation of DSGE Models” did, by filtering the observed trending variables inside the model by means of observation equations. Here is the observation equations I’m specifying for detrending y and h:

y_obs = y + y_trend;
(y_trend-y_trend(-1))-(y_trend(-1)-y_trend(-2))= n_y;

h_obs = h + h_trend;
(h_trend-h_trend(-1))-(h_trend(-1)-h_trend(-2))= n_h;

Here my observable variables (i.e. y_obs and h_obs) are composed of a cycle (i.e y and h) and a trend (y_trend and h_trend), and the trend components follow what Stock and Watson defined as a one-sided HP-filter.

However, at the estimation I get the error “Error using chol. Matrix must be positive definite”

I’d really appreciate you could check my model and the way I’m doing things and you could tell me what’s wrong with it. Thanks!!!
Ferroni_4.mod (1.46 KB)

Please provide the data file

Here is the data file and the mod file. Thanks!
Ferroni.zip (10.4 KB)