Dynare issues and DSGE modelling

Hello, I am currently replicating the following for my Advanced Time Series Master’s project: to estimate the DSGE model(s) in Ch4 in the Handbook of Bayesian
Econometrics by Marco Del Negro and Fran Shordfeide (2010). With the following instructions: ˆ Estimate the model(s).
ˆ Report your estimation results and discuss.
– Report steady states of the model.
– Prior distribution and posterior estimates for all models (in one table).
– MCMC acceptance rates.
– IRFs.
1.2 Evaluation
Report and discuss the followings:
ˆ Predictive checks: Prior check and mode check.
ˆ Posterior-odd ratio.
ˆ DSGE vs VAR (optional).
ˆ Figure of posterior distribution.
ˆ MCMC.

I have already successfully simulated the model, but as soon as I incorporate my data I run into issues. I have even differenced my variables and tried again but no luck. I obtained Euro Area data Here is my code: (as well as the transformations I also tried)
data=readtimetable(“Data.xlsx”)

data=data(54:end, 1:end)

Y_ldiff = diff(log(data.Y));
C_ldiff=diff(log(data.C));
H_ldiff= diff(log(data.H));
I_ldiff=diff(log(data.I));
i_diff = diff(data.i);

Data_diff = array2timetable([Y_ldiff C_ldiff H_ldiff I_ldiff i_diff],…
‘RowTimes’,data.Date(2:end),‘VariableNames’,{‘ydiff’ ‘C_ldiff’ ‘hdiff’ ‘I_ldiff’ ‘i_diff’});

//----------------------------------------------------------------

// 1. Endogenous variables

//----------------------------------------------------------------

var

Y

C

I

K

H

W

R

a

B

A

ydiff

hdiff;

//----------------------------------------------------------------

// 2. Exogenous variables (3)

//----------------------------------------------------------------

varexo

e_a

e_b;

//----------------------------------------------------------------

// 3. Parameters

//----------------------------------------------------------------

parameters

B_star

alpha //capital output share// capital elasticity in the production function

beta //household subjective discount factor

gamma // DETERMINISTIC TREND COMPONENT OF TECHNOLOGY GROWTH

rho_a // persistence of tech progress

rho_b

sigma_a

sigma_b

delta //depreciation rate

nu //the aggregate labor supply elasticity

tau; //

B_star=1;

alpha=0.66;

rho_a = 0.01;

rho_b= 0.8;

tau = 0.025;

beta = 0.99;

delta = 0.025;

nu = 2;

gamma = 1.49;

sigma_a= 0.01;

sigma_b= 0.01;

//----------------------------------------------------------------

// 4. Model

//----------------------------------------------------------------

model;

1/C=beta*(1/C(+1))exp(-a(+1))(R(+1) + (1-delta));

1/CW=1/B(H/B)^(1/nu);

W=alpha*(Y/H);

R=(1-alpha)*(Y/K)*exp(a);

Y=H^alpha*(K*exp(-a))^(1-alpha);

Y=C+I;

K=(1-delta)*K(-1)*exp(-a)+I(-1);

a=ln(gamma)+(rho_a-1)ln(A(-1))+sigma_ae_a;

ln(A)=rho_aln(A(-1))+sigma_ae_a;

ln(B)=(1-rho_b)log(B_star)+rho_bln(B(-1))+sigma_b*e_b;

ydiff=gamma+Y-Y(-1)+a;

hdiff=H-H(-1);

end;

initval;

Y=1;

C=0.6696;

I=0.3304;

K=0.95585;

H=0.5;

W=1.32;

R=0.53;

a=0.4;

B=1;

A=1;

end;

//----------------------------------------------------------------

// 5. Shocks

//----------------------------------------------------------------

shocks;

var e_a; stderr 0.01;

var e_b; stderr 0.01;

end;

//----------------------------------------------------------------

// 6. The Steady State Model

//----------------------------------------------------------------

steady;

check;

//----------------------------------------------------------------

// 7. Estimation of Parameters

//----------------------------------------------------------------

estimated_params;

alpha, 0.66,-0.000000000000001,0.999999999999,BETA_PDF,0.66,0.02;

gamma,0.003,-10000,99999999999,NORMAL_PDF,0,.1;

nu,0.4,-1E-15,999999999999,GAMMA_PDF,2,1;

rho_a,0.95,-1E-15,0.999999999999,BETA_PDF,0.95,0.02;

rho_b,0.98,-1E-15,0.999999999999,BETA_PDF,0.8,0.1;

stderr e_a,0.01,-1E-15,999999999999,INV_GAMMA_PDF,0.015,4;

stderr e_b,0.007,-1E-15,999999999999,INV_GAMMA_PDF,0.01,4;

end;

varobs ydiff hdiff;

estimation(datafile=DSGE_data_diff,xls_sheet=DSGE_data_diff,nobs=114,mh_replic=1000,mh_jscale=0.5);

And my output/error that I get:

Configuring Dynare …
[mex] Generalized QZ.
[mex] Sylvester equation solution.
[mex] Kronecker products.
[mex] Sparse kronecker products.
[mex] Local state space iteration (second order).
[mex] Bytecode evaluation.
[mex] k-order perturbation solver.
[mex] k-order solution simulation.
[mex] Quasi Monte-Carlo sequence (Sobol).
[mex] Markov Switching SBVAR.

Using 64-bit preprocessor
Starting Dynare (version 4.5.4).
Starting preprocessing of the model file …
Found 12 equation(s).
Evaluating expressions…done
Computing static model derivatives:

  • order 1
    Computing dynamic model derivatives:
  • order 1
  • order 2
    Processing outputs …
    done
    Preprocessing completed.

STEADY-STATE RESULTS:

Y 0.78787
C 0.5276
I 0.26027
K 0.753013
H 0.990366
W 0.525053
R 0.530051
a 0.398776
B 1
A 1
ydiff 1.88878
hdiff 0

EIGENVALUES:
Modulus Real Imaginary

           0               -0                0
   1.691e-18       -1.691e-18                0
   2.435e-16        2.435e-16                0
        0.01             0.01                0
      0.6271           0.6271                0
         0.8              0.8                0
       1.611            1.611                0
   3.515e+16        3.515e+16                0
         Inf             -Inf                0

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

The rank condition is verified.

You did not declare endogenous variables after the estimation/calib_smoother command.
Error using load_mat_file_data_legacy
makedataset: The variable(s) ydiff, hdiff listed in varobs are not contained in the dataset

Error in makedataset (line 128)
DynareDataset = load_mat_file_data_legacy(datafile, DynareOptions.varobs);

Error in dynare_estimation_init (line 538)
[dataset_, dataset_info, newdatainterfaceflag] = makedataset(options_, options_.dsge_var*options_.dsge_varlag, gsa_flag);

Error in dynare_estimation_1 (line 116)
dynare_estimation_init(var_list_, dname, , M_, options_, oo_, estim_params_, bayestopt_);

Error in dynare_estimation (line 105)
dynare_estimation_1(var_list,dname);

Error in ModifiedDSGEmodels (line 240)
oo_recursive_=dynare_estimation(var_list_);

Error in dynare (line 223)
evalin(‘base’,fname) ;

Since you did not upload Data.xlsx, so I could not run the compelete the file.
But from the erros: You did not declare endogenous variables after the estimation/calib_smoother command. Error using load_mat_file_data_legacy makedataset: The variable(s) ydiff, hdiff listed in varobs are not contained in the dataset

There are something wrong in varobs ydiff hdiff bolck and estimation block . We get the Y_Idiff C_Idiff ... from the data, so ydiff and hdiff are not consistent.

Hello! Thank you for replying! I have figured out what went wrong and my model is now running smoothly!