hello dear prof. pfeifer.

I have some problems in my code, I have tried to solve them according to similar topics, But failed. my model is heterogeneous agent model with landa share of rule of thumb households.

here is the first note i got when running the model,

**Note: numbers do not add up to 100 due to non-zero correlation of simulated shocks in small samples**

**You did not declare endogenous variables after the estimation/calib_smoother command.**

**Posterior IRFs will be computed for the 13 endogenous variables**

**of your model, this can be very long…**

**Choose one of the following options:**

** [1] Consider all the endogenous variables.**

** [2] Consider all the observed endogenous variables.**

** [3] Stop Dynare and change the mod file.**

by choosing (1), i get several warnings including:

Warning: Matrix is close to singular or badly scaled. Results may be inaccurate.

and n the end this is what i face:

**MODE CHECK**

**Fval obtained by the minimization routine (minus the posterior/likelihood)): 2439.193557**

**Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate.**

**RCOND = NaN. **
> In dynare_estimation_1 (line 339)
** In dynare_estimation (line 105)**

** In rgh_esfand (line 235)**

** In dynare (line 223) **

**RESULTS FROM POSTERIOR ESTIMATION**

**parameters**

** prior mean mode s.d. prior pstdev**

**landa 0.250 0.6702 NaN beta 0.1000 **

**rho_m 0.782 0.4031 NaN beta 0.0500 **

**rho_pi -1.245 -0.6265 NaN norm 0.1000 **

**rho_x -2.234 -1.5979 NaN norm 0.1000 **

**phi 3.000 0.8174 NaN gamm 0.5000 **

**beta 0.960 0.9788 NaN beta 0.0120 **

**rhoa 0.700 0.7607 NaN beta 0.1000 **

**Log data density [Laplace approximation] is NaN.**

**Error using chol**

**Matrix must be positive definite.**

**Error in posterior_sampler_initialization (line 84)**

**d = chol(vv);**

**Error in posterior_sampler (line 60)**

** posterior_sampler_initialization(TargetFun, xparam1, vv,**

** mh_bounds,dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,oo_);**

**Error in dynare_estimation_1 (line 447)**

** posterior_sampler(objective_function,posterior_sampler_options.proposal_distribution,xparam1,posterior_sampler_options,bounds,dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,oo_);**

** Error in dynare_estimation (line 105)**

** dynare_estimation_1(var_list,dname);**

**Error in rgh_esfand (line 235)**

**oo_recursive_=dynare_estimation(var_list_);**

**Error in dynare (line 223)**

**evalin(‘base’,fname) ; **

**>>** here are my code and data file, if needed

rgh_esfand.mod (2.0 KB)

rgh_amar.m (3.6 KB)

could you please help me? thank you