# Bayesian Estimation - Dornbusch Model

Hi All,

I’m trying to estimate Dornbusch’s model and I get the following error:

ERROR: model2.mod: line 51, col 11: syntax error, unexpected ‘(’, expecting COMMA
Error using dynare (line 174)
DYNARE: preprocessing failed

May I please ask for some advice on how to solve this. As per the highlighted error, I should include a “,” after the command “estimation” which does not make sense. Please find below the code. Thank you very much in advance for your help!

Also, could anyone help me on how to forecast with this code. I mean, the last observation of the monthly fx rate is as of April 2014 and I would like to run the model in order to get May 14, June 14, etc. Is this possible? Thanks!!!

Felipe

var epsilon p s m_d y_d y t_bill;
varexo t_bill_star p_star m epsilon_bar y_bar g;
parameters delta, eta, psi, phi;

delta=0.5;
eta=1;
psi=0.5;
phi=0.5;

model;
t_bill = t_bill_star + s(+1) - s;
m_d = p(-1) + phiy - etat_bill;
epsilon = s + p_star - p;
y_d = y_bar + delta*(s + p_star - p(-1) - epsilon_bar) + g;
p - p(-1) = psi*(y_d - y_bar) + s(+1) - s;
y_d = y;
m_d = m;
end;

varobs s;

initval;
epsilon_bar = 1;
epsilon = 1;
y_bar = 1;
p_star = 1;
p = 1;
t_bill_star = 0.5;
t_bill = 0.5;
m = 1;
m_d = 1;
g = 0;
end;

shocks;
var m;
periods 1:8;
values 1.1;
end;

check;

estimated_params;
delta, beta_pdf, 0.35, 0.02;
eta, beta_pdf, 0.99, 0.002;
psi, beta_pdf, 0.25, 0.05;
phi, beta_pdf, 0.30, 0.04;

estimation(datafile=fxchile,nobs=364,loglinear,mh_replic=2000,mode_compute=4,mh_nblocks=2,mh_drop=0.45,mh_jscale=0.65,diffuse filter);

You are missing and

closing the estimated_params-block

Thanks very much for the quick answer!

Unfortunately, when running the model now I am getting other error. Could anyone please assist with this? I made sure to input data in the .xls file with the same name as in the model: “s”. Thank you all again,
Felipe

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

Error in initialize_dataset (line 32)

Error in dynare_estimation_init (line 471)
dataset_ =
initialize_dataset(options_.datafile,options_.varobs,options_.first_obs,options_.nobs,transformation,options_.prefilter,xls);

Error in dynare_estimation_1 (line 81)
[dataset_,xparam1, hh, M_, options_, oo_, estim_params_,bayestopt_] =
dynare_estimation_init(var_list_, dname, ], M_, options_, oo_, estim_params_, bayestopt_);

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

Error in model2 (line 169)
dynare_estimation(var_list_);

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

Please post the dataset and the mod-file.

Thanks very much. I have attached the .mod and .xls files.
model2.mod (862 Bytes)
fxchile2.xls (32.5 KB)

That is a bug in Dynare 4.4. Please try 4.3.4 for now. Additional things:

Your shocks block does not allow for stochastic shocks, yielding a 0 covariance matrix and thus stochastic singularity. You might want to estimate the standard deviation of the monetary policy shock by using

```estimated_params; ... stderr m, gamma_pdf, 0.1, 1; end; ```
After you solve those issues, forecasting should be easily possible.

Thanks very much!

I solved the issues you mentioned and the program now works. However, the forecast is a disaster. I would like to know if that’s because Dornbusch model doesn’t work empirically or if I am doing something wrong. The exchange rate goes from 500s to 0.2s… I am attaching my codes and data just in case anyone can give a useful advice.

Also, I have a question about forecasting. If I put “forecast=24” that means that it’s going to give me the forecast for the next 24 periods after the last observed data or just 24 points to be compared against original figures?

Felipe
dornbusch.mod (1.02 KB)

Attaching monthly data now, in logs for the last five yeas.

Please follow my advice on the data. Your FX data has a mean of 500, but your exchange rate has a mean of 1. Something is inconsistent here. The model will always forecast that in the long-run the exchange rate goes back to steady state.

Thank you as always, I appreciate.

I followed your advice on data: it’s in logs as in Dornbusch model and as per “A Guide to Specifying Observation Equations for the Estimation of DSGE Models” I included the below:

var epsilon … t_bill s_obs t_bill_obs p_obs y_obs;

model;
.
.
t_bill = t_bill_obs;
s = s_obs;
end;

However, it continues bringing inconsistent forecast results. For the exchange rate, starts at 6.27(528) and then it goes to -5.21(0.01). I must be doing something really wrong, but I can’t figure out what is it. May I please ask for your help? I am about to give up with this. I wanted to start learning with Dornbusch cause it has a much more simple structure for the exchange rate than “Small Open Economies” models or “New Keynesian Models”.

Thank you very much in advance,

Thank you,

Please post the last version of the data and the mod-file.

Please find attached the .mod file. Thanks!
dornbusch.mod (1.22 KB)

Attaching now the data (please note I wasn’t able to attach the .mat file, so I am sending a .xls). Thanks!

Data in .xls for the last five years, on a monthly basis, in logs.
dornbuschdata.xls (22.5 KB)

Your last mod-file does not run.

Sorry, I am sending it again. I realized I had to make another correction to the data (next post attached). s, the exchange rate, needed to be expressed as a monthly rate of change and now the results make a bit more sense. I would highly appreciate if you could run it and let me know your suggestions, cause I am not 100% sure how I should interpret these forecasts. Thanks very much,

Felipe
thesis.mod (954 Bytes)

Here is the data file “datos” to run the mod. file “thesis”. Data is the monthly change of the exchange rate, in logs. I would highly appreciate if anyone could run it and let me know their impressions and how I should interpret the forecast for the next 24 periods.
Thanks very much,

Felipe
datos.xls (19 KB)

Let me clarify my point. Your model variables are in logs and you have done the arbitrary normalization that the steady state of the log nominal exchange rate is 1. Now you have to match this model to the data where the nominal exchange rate is not in logs and its log has not mean 1. The best way is to specify an observation equation that gets rid of the different means (as described in Listing 7 of Pfeifer “A Guide to Specifying Observation Equations for the Estimation of DSGE Models”)

That is, you demean the log empirical exchange rate in the Excel file by just subtracting the mean. Then you use an observation equation of the form

``s-steady_state(s)  = s_obs;``

telling the model that the observed log exchange rate is one where the mean has been subtracted.

This formulation also should make forecasting easier, because your forecasts are then for the percentage deviation of the exchange rate from its sample mean.

thesis.mod (982 Bytes)
dornbuschdata.xls (31.5 KB)

Johannes, thanks so much, it’s very clear now. But, unfortunately, I was not able to run the model.

Matlab goes through the same process again and again showing always the same option…

"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.

options [default is 1] = "

Try Dynare 4.4.2. With the Excel file containing more than 1 series it should run now. The error you describe usually happens when people give the data-file the same name as the mod-file.