Dear Professor:
I am using Bayesian estimation to estimate the parameters of DSGE model shocks, when directly assigning values to shock parameters, the program works fine; but when estimating shock parameters with Bayesian estimation, the following error message appears

Log data density [Laplace approximation] is NaN.
wrong using chol
he matrix must be positive definite with real diagonals.
wrong posterior_sampler_initialization (line 84)
d = chol(vv);
wrong posterior_sampler (line 60)
posterior_sampler_initialization(TargetFun, xparam1, vv, mh_bounds,dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,oo_);
wrong dynare_estimation_1 (line 471)
posterior_sampler(objective_function,posterior_sampler_options.proposal_distribution,xparam1,posterior_sampler_options,bounds,dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,oo_);
wrong dynare_estimation (line 118)
dynare_estimation_1(var_list,dname);

I don’t know where is the problem? Hope to get advice from professors, thank you very much!
In addition, the observed variable data estimated by Bayesian is the data obtained by the actual data after X12 seasonal adjustment and HP filtering. The procedure and data for Bayesian estimation are as follows paper_estimate.mod (6.2 KB) paper_data.mat (4.5 KB)

phi_p is clearly not identified at first order as it is always multiplied by a qudratic term that is 0 in steady state and therefore drops out. Why is there no FOC containing

phi_p*(vpi-1)

as is usual?
2. See Estimation of parameters - #2 by jpfeifer
3. The correctness of the observation equations is hard to judge. You are not supposed to use the two-sided HP-filter. Also, it’s unclear whether the frequency of the interest rates in the data and the model matches.

This may be because my model has some errors, my price adjustment cost should be changed from (C_t^P)/P_t ϕ_p/2 ((P_t (i))/(P_(t-1) (i) )-1)^2 Y_t (i) to (C_t^P)/P_t ϕ_p/2 ((P_t (i))/(P_(t-1) (i) )-1)^2 Y_t；also the FOC condition about price is missing
2、Thanks for the suggestion, I will have a try
3、ye,I do use the two-sided HP-filter,I will try one-sided HP-filter
Thanks for your help again,Professor.

hello professor
My operational results go back to the original question ‘’Log data density [Laplace approximation] is NaN."; the identification-command also doesn’t show that there is an identification problem. I have been unsuccessful in finding the problem by removing one observed variable at a time and mode_check-plots.
My data processing process is as follows:
The raw data RAT has not been processed, and is used as the observation data of the benchmark interest rate. The observation equation is vr_obs = vr*4;
The raw data GDP, social retail product consumption, M2-M0 have all been processed by X12-ARIMA, logarithm, one-sided HP filter, and the processed data are used as time series of vy_obs, vc_obs, and vd_obs respectively. The observation equation takes vy as an example, as follows:
vy_obs = log(vy)-log(vy_ss);
I hope the professor can help me solve this problem, thank you very much!

good day ! Prof.Pfeifer
So how should I solve this problem?
If I change the way of assigning initial values to variables in my mod file from initval-block to steady_state_model-block (just like listing6 in Pfeifer(2013):“…”), then change the variable steady state in the observation equation The value is obtained using the steady_state()-operator (as in listing7 in Pfeifer(2013):“…”), e.g.

Happy day! Prof.Pfeifer
Sorry to bother you again.I have two questions aboutsteady_state_model-block to ask you
In steady_state_model-block, the steady-state values of all exogenous variables can only be calculated with structural parameters, or with exogenous variables and structural parameters that have been calculated.
question1:
If I only consider an economic model with zero inflation, can I set vpi (level variable via inflation) = 1directly in steady_state_model-block?
Or can I only set the initial value of the inflation rate to 1 in the initval-block?
question2:
The foc conditions of my model includevpi(vpi-1) and (vpi-1)^2, and it is relatively difficult to solve the specific expression of vpi; my previous choice was to assign an initial value of 1 to vpi and an initial value to labor is 1/3, then the parameters omega and psi are solved by expressions; but in the case of steady_state_model-block, the parameters omega and psi are not feasible by expressions, what should I do?
In this case, isn’t it just a matter of changing the model to log-linear form?

yes, I mean set the steady state of the vpi to 1
2.The second point about expressions means in my steady_state_model -blocks parameters psi and omega is computed by other parameters and variables. Following is my steady_state_model -blocks:

I assign parameter values in steady_state_model -blocks like above,but my mod file can not run successfully, i don’t know why.Following is “error message”:

Wrong use print_info (line 32)
The steadystate file did not compute the steady state
Wrong dynare_estimation_init (line 619)
print_info(info, 0, options_);

Prof.Pfeifer , I have solved the above problem according to Remark 5 in your guide book, but the old problem comes back again!

Log data density [Laplace approximation] is NaN.
wrong using chol
he matrix must be positive definite with real diagonals.
wrong posterior_sampler_initialization (line 84)
d = chol(vv);

Prof. Pfeifer:
I have made some changes for my prior, and correct the data treatment of vr_obs (according to 4.3.3 Interest Rate in your book), and use mode_compute=6

Now the code runs successfully, thank you very much for your help these days.
Have fun every day!!!