Page 1 of 2
Bayesian Estimation - Dornbusch Model
Posted:
Thu May 15, 2014 5:18 am
by felipe.klein
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) + phi*y - eta*t_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;
steady;
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);
Re: Bayesian Estimation - Dornbusch Model
Posted:
Thu May 15, 2014 8:43 am
by jpfeifer
You are missing and
- Code: Select all
end;
closing the estimated_params-block
Re: Bayesian Estimation - Dornbusch Model
Posted:
Thu May 15, 2014 1:30 pm
by felipe.klein
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 using load_xls_file_data (line 113)
load_xls_file_data: I am not able to read the dates!
Error in read_variables (line 92)
[freq,init,data,varlist] = load_xls_file_data(fullname,xls_sheet,xls_range);
Error in initialize_dataset (line 32)
rawdata = read_variables(datafile,varobs,[],xls.sheet,xls.range);
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) ;
>>
Re: Bayesian Estimation - Dornbusch Model
Posted:
Thu May 15, 2014 3:10 pm
by jpfeifer
Please post the dataset and the mod-file.
Re: Bayesian Estimation - Dornbusch Model
Posted:
Thu May 15, 2014 3:50 pm
by felipe.klein
Thanks very much. I have attached the .mod and .xls files.
Re: Bayesian Estimation - Dornbusch Model
Posted:
Fri May 16, 2014 5:29 am
by jpfeifer
That is a bug in Dynare 4.4. Please try 4.3.4 for now. Additional things:
- the Dornbusch model is in logs, but your data is not. That won't work as data and model need to be consistent. Please see Pfeifer(2013): "A Guide to Specifying Observation Equations for the Estimation of DSGE Models"
https://sites.google.com/site/pfeiferecon/Pfeifer_2013_Observation_Equations.pdf.
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
- Code: Select all
estimated_params;
...
stderr m, gamma_pdf, 0.1, 1;
end;
After you solve those issues, forecasting should be easily possible.
Re: Bayesian Estimation - Dornbusch Model
Posted:
Sun May 18, 2014 11:48 pm
by felipe.klein
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?
Thank you in advance,
Felipe
Re: Bayesian Estimation - Dornbusch Model
Posted:
Sun May 18, 2014 11:49 pm
by felipe.klein
Attaching monthly data now, in logs for the last five yeas.
Re: Bayesian Estimation - Dornbusch Model
Posted:
Mon May 19, 2014 8:39 am
by jpfeifer
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.
Re: Bayesian Estimation - Dornbusch Model
Posted:
Mon May 19, 2014 12:56 pm
by felipe.klein
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,
Re: Bayesian Estimation - Dornbusch Model
Posted:
Mon May 19, 2014 12:57 pm
by jpfeifer
Please post the last version of the data and the mod-file.
Re: Bayesian Estimation - Dornbusch Model
Posted:
Mon May 19, 2014 2:14 pm
by felipe.klein
Please find attached the .mod file. Thanks!
Re: Bayesian Estimation - Dornbusch Model
Posted:
Mon May 19, 2014 2:24 pm
by felipe.klein
Attaching now the data (please note I wasn't able to attach the .mat file, so I am sending a .xls). Thanks!
Re: Bayesian Estimation - Dornbusch Model
Posted:
Mon May 19, 2014 11:57 pm
by felipe.klein
Data in .xls for the last five years, on a monthly basis, in logs.
Re: Bayesian Estimation - Dornbusch Model
Posted:
Tue May 20, 2014 9:09 am
by jpfeifer
Your last mod-file does not run.