I solved for the initial guess for the steady state outside dynare. The inital guess works if I set the home bias tau to be 1 for all destination and origin country pairs. But it does not work when I set home bias for foreign countries to be lower than 1. It is weird that SS is solved outside dynare and all equations have close to zero residues. But dynare says there is still a 0.0143 gap. Can someone help me look into this? Thank you so much! The steady_state.m is the first step for solving SS assuming trade is balanced, the second step is given the first step answer and relax the balanced trade assumption.

Thank you professor. I solved it. There is another question. I am using the built in SMM of dynare. I am wondering how I can target the standard deviation of a variable. I can only see E(x^2) possible.

Thatâ€™s only possible with the prefilter-option. But you can always define a demeaned variable in the model block so that the centered and uncentered moment coincide.

Thank you very much professor. I used the prefilter option in SMM. In SMM it says the variance is almost perfectly matched to data. But when I do the stochastic simulation, the approximated theoretical moments report main.m (8.7 KB) Steady_State.m (7.8 KB) Steady_State_Step2.m (17.1 KB) M_Calivar.mat (2.9 KB) dynare_Benchmark.mod (28.9 KB)
the variances different from SMM. Could you please explain that for me?

Here is everything. The problem is the SMM result showed that variance is matched with the data, and it did match the data. But the variance calculated by the stochastic simulation does not match data.