Prameter estimation

Dear, Professor, now I am doing the parameter estimation by Bayesian Estimation.But when I run the code, it got the following errors:
错误使用 load_mat_file_data_legacy (line 30)
makedataset: The variable(s) dY, dG, dB, dR, dPi, dT listed in varobs are not contained in the dataset

出错 makedataset (line 129)
DynareDataset = load_mat_file_data_legacy(datafile, DynareOptions.varobs);

出错 dynare_estimation_init (line 553)
[dataset_, dataset_info, newdatainterfaceflag] = makedataset(options_, options_.dsge_var*options_.dsge_varlag, gsa_flag);

出错 dynare_estimation_1 (line 110)
dynare_estimation_init(var_list_, dname, [], M_, options_, oo_, estim_params_, bayestopt_);

出错 dynare_estimation (line 118)
dynare_estimation_1(var_list,dname);

出错 parameterestimation.driver (line 858)
oo_recursive_=dynare_estimation(var_list_);

出错 dynare (line 281)
evalin(‘base’,[fname ‘.driver’]);

It seems that the data cannot be identified. Could you please help me to see what should I do to solves?

parameterestimation.mod (7.6 KB)

This is the dataset . I did log-linearization preprocessing using excel.
estidata.mat (2.2 KB)

Dynare does not support Matlab tables. You need to provide the variables separately.

Sorry,I didn’t quite understand this, I stored the data in the workspace seperately, but it still asked me to have a data file.

Inside of your mat-file, the format is a table:

image

You should instead save your variables as separate vectors.

I save the data corresponding to each variable as column vectors and store these column vectors together in a .mat file, the problem was solved, but I encountered a new problem with the following error:
Error in computing likelihood for initial parameter values

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):

错误使用 print_info (line 32)
The generalized Schur (QZ) decomposition failed. For more information, see the documentation for Lapack function dgges: info=28,
n=26. You can also run model_diagnostics to get more information on what may cause this problem.

出错 print_info (line 32)
error(message);

出错 initial_estimation_checks (line 305)
print_info(info, DynareOptions.noprint, DynareOptions)

出错 dynare_estimation_1 (line 159)
oo_ =
initial_estimation_checks(objective_function,xparam1,dataset_,dataset_info,M_,estim_params_,options_,bayestopt_,bounds,oo_);

出错 dynare_estimation (line 102)
dynare_estimation_1(var_list,M_.dname);

出错 parameterestimation.driver (line 845)
oo_recursive_=dynare_estimation(var_list_);

出错 dynare (line 281)
evalin(‘base’,[fname ‘.driver’]);

for this error,what should I do to solve it?

Make sure you can run model simulations first. There seems to be an issue with your linearization. The dQ-equation shows a residual and consequently no steady state can be found.

dynare parameterestimation
Starting Dynare (version 5.3).
Calling Dynare with arguments: none
Starting preprocessing of the model file …
Found 34 equation(s).
Evaluating expressions…done
Computing static model derivatives (order 1).
Computing dynamic model derivatives (order 2).
Processing outputs …
done
Preprocessing completed.

Equation solved.

fsolve completed because the vector of function values is near zero
as measured by the default value of the function tolerance, and
the problem appears regular as measured by the gradient.

Residuals of the static equations:

Equation number 1 : 0 : dgamma
Equation number 2 : 0 : 2
Equation number 3 : 0 : dCT
Equation number 4 : 0 : 4
Equation number 5 : 0 : 5
Equation number 6 : 0 : 6
Equation number 7 : 0 : dPhi
Equation number 8 : 0 : dX
Equation number 9 : 0 : dv
Equation number 10 : 0 : deta
Equation number 11 : 0 : 11
Equation number 12 : 0 : dN
Equation number 13 : 0 : dZ
Equation number 14 : 0 : dY
Equation number 15 : 0 : dK
Equation number 16 : 0 : dW
Equation number 17 : 0 : 17
Equation number 18 : 0 : dI
Equation number 19 : 0 : dH
Equation number 20 : 0 : dQ
Equation number 21 : 0 : dpistar
Equation number 22 : 0 : df1
Equation number 23 : 0 : df2
Equation number 24 : 0 : dPi
Equation number 25 : 0 : 25
Equation number 26 : 0 : 26
Equation number 27 : 0 : dP
Equation number 28 : 0 : dR
Equation number 29 : 0 : 29
Equation number 30 : 0 : 30
Equation number 31 : 0 : 31
Equation number 32 : 0 : dO
Equation number 33 : 0 : dA
Equation number 34 : 0 : dxi

MODEL_DIAGNOSTICS: The Jacobian of the static model is singular
MODEL_DIAGNOSTICS: there is 1 colinear relationships between the variables and the equations
Colinear variables:
dIn
Colinear equations
26 34

MODEL_DIAGNOSTICS: The presence of a singularity problem typically indicates that there is one
MODEL_DIAGNOSTICS: redundant equation entered in the model block, while another non-redundant equation
MODEL_DIAGNOSTICS: is missing. The problem often derives from Walras Law.

Error in computing likelihood for initial parameter values

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):

错误使用 print_info (line 32)
The generalized Schur (QZ) decomposition failed. For more information, see the documentation for Lapack function dgges: info=28,
n=26. You can also run model_diagnostics to get more information on what may cause this problem.

出错 print_info (line 32)
error(message);

出错 initial_estimation_checks (line 305)
print_info(info, DynareOptions.noprint, DynareOptions)

出错 dynare_estimation_1 (line 159)
oo_ =
initial_estimation_checks(objective_function,xparam1,dataset_,dataset_info,M_,estim_params_,options_,bayestopt_,bounds,oo_);

出错 dynare_estimation (line 102)
dynare_estimation_1(var_list,M_.dname);

出错 parameterestimation.driver (line 845)
oo_recursive_=dynare_estimation(var_list_);

出错 dynare (line 281)
evalin(‘base’,[fname ‘.driver’]);

Thanks for your reminder,I checked the dQ equation and solve the problem. But unfortunately it run into another error.According to the MODEL_DIAGNOSTICS, there is a collinearity problem, I think maybe there is a problem with my numerical linearization, I will check it again.

Dear Professor,I checked my linearation again and get the previous problem solved,but I met the new errors as follow:
Starting Dynare (version 5.3).
Calling Dynare with arguments: none
Starting preprocessing of the model file …
Found 33 equation(s).
Evaluating expressions…done
Computing static model derivatives (order 1).
Computing dynamic model derivatives (order 2).
Processing outputs …
done
Preprocessing completed.

Equation solved.

fsolve completed because the vector of function values is near zero
as measured by the default value of the function tolerance, and
the problem appears regular as measured by the gradient.

Residuals of the static equations:

Equation number 1 : 0 : dgamma
Equation number 2 : 0 : 2
Equation number 3 : 0 : dCT
Equation number 4 : 0 : 4
Equation number 5 : 0 : 5
Equation number 6 : 0 : 6
Equation number 7 : 0 : dPhi
Equation number 8 : 0 : dX
Equation number 9 : 0 : dv
Equation number 10 : 0 : deta
Equation number 11 : 0 : 11
Equation number 12 : 0 : dN
Equation number 13 : 0 : dZ
Equation number 14 : 0 : dY
Equation number 15 : 0 : dK
Equation number 16 : 0 : dW
Equation number 17 : 0 : 17
Equation number 18 : 0 : 18
Equation number 19 : 0 : dQ
Equation number 20 : 0 : dpistar
Equation number 21 : 0 : df1
Equation number 22 : 0 : df2
Equation number 23 : 0 : dPi
Equation number 24 : 0 : 24
Equation number 25 : 0 : 25
Equation number 26 : 0 : dP
Equation number 27 : 0 : dR
Equation number 28 : 0 : 28
Equation number 29 : 0 : 29
Equation number 30 : 0 : 30
Equation number 31 : 0 : dO
Equation number 32 : 0 : dA
Equation number 33 : 0 : dxi

MODEL_DIAGNOSTICS: No obvious problems with this mod-file were detected.

Error in computing likelihood for initial parameter values

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):

错误使用 print_info (line 32)
Blanchard & Kahn conditions are not satisfied: no stable equilibrium.

出错 print_info (line 32)
error(message);

出错 initial_estimation_checks (line 305)
print_info(info, DynareOptions.noprint, DynareOptions)

出错 dynare_estimation_1 (line 159)
oo_ =
initial_estimation_checks(objective_function,xparam1,dataset_,dataset_info,M_,estim_params_,options_,bayestopt_,bounds,oo_);

出错 dynare_estimation (line 102)
dynare_estimation_1(var_list,M_.dname);

出错 parameterestimation.driver (line 838)
oo_recursive_=dynare_estimation(var_list_);

出错 dynare (line 281)
evalin(‘base’,[fname ‘.driver’]);

estidata1.mat (1.9 KB)
parameterestimation.mod (8.3 KB)

I don’t know where the problem is and what to do next,could you please give me some advise?

Most likely, there is still a timing error. Add check to see

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

The rank condition ISN'T verified!

Your model is explosive.

estidata2.mat (1.5 KB)
test3.mod (9.3 KB)

Dear professor,sincerely thanks for your help, since manual linearization is always a problem, I chose to use the “loglinear” option in estimation() to let dynare linearize automatically, but the estimated parameters are very different, I think, probably there is a problem with the data I used, the actual value of Y B G T should not be used directly, what kind of processing should I do on the real data to fix the model?


You need to remove the seasonal pattern and deal with the trend.

I see! I recall that the teacher talked about this in class, but I still don’t know exactly how to do it. Can I take the liberty of asking you for some references?

Have a look at
Pfeifer(2013): “A Guide to Specifying Observation Equations for the Estimation of DSGE Models”

Sincerely thanks for your help again! I think my model will work smoothly after dealing with this problem.Best regards!

HI dear chuxi
How you store these column vectors together in a .mat file ?