dsge__var

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

dsge__var

Postby Ina » Mon Sep 22, 2014 2:01 pm

Hi,
I am trying to do the following example. the new is the estimation of a dsge_var model defining the dsge_prior_weight as a parameter, but it doesn't work.


// .mod file for estimating model

var pi, y, r, pie, epspi, epsy, epsr, epspie, inflobs, outputobs, ffrobs, pieobs; % endogenous variables and exogenous latent AR(1)processes
varexo eepspi, eepsy, eepsr, eepspie; % shocks

parameters beta, alpha, dsge_prior_weight, gamma, k, h, tau, phipi, phiy, phir, rhopi, rhor, rhoy, rhopie;

//initial values for the parameter vector
//quarterly data(no annualization)

//fixed/steady state parameters
beta = 0.99;
rhopi=0.6;

//structural model
alpha=1;
k=0.05;
h=0.9;
tau=0.15;
phipi=1.5;
phiy=0.25;
phir=0.9;
rhopi=0.6;
rhor=0.5;
rhoy=0.5;
rhopie=0.5;
gamma=0.5;





model;
// state space
pi=beta*(gamma*pi(1)+(1-gamma)*pie)+k*y+epspi;
y=(1/(1+h))*y(1)+(h/(1+h))*y(-1)-tau*(r-pi(1))+epsy;
pie=rhopie*pie(-1)+alpha*y(-1)+epspie;
r=(1-phir)*(phipi*pi+phiy*y)+phir*r(-1)+epsr;
epspi=rhopi*epspi(-1)+eepspi;
epsy=rhoy*epsy(-1)+eepsy;
epsr=rhor*epsr(-1)+eepsr;
epspie=rhopie*epspie(-1)+eepspie;

//measurement equation
inflobs=pi;
outputobs=y;
ffrobs=r;
pieobs=pie;
end;

steady(solve_algo=0);check;

estimated_params;
dsge_prior_weight, beta_pdf,0.5,0.4;
beta, beta_pdf, 0.4,0.1;
alpha, beta_pdf, 0.9,0.03;
gamma, beta_pdf, 0.5,0.2;
k, 0.04,gamma_pdf,0.1,0.02;
h, 0.62,beta_pdf,0.5,0.1;
tau, 0.10,gamma_pdf,0.1,0.05;
phipi,1.99, normal_pdf,1.5,0.2;
phiy,0.15,gamma_pdf,0.3, 0.2;
phir, 0.75,beta_pdf,0.5,0.2;
rhopi,0.5,beta_pdf,0.6,0.1;
rhor,0.5,beta_pdf,0.6,0.1;
rhoy,0.5,beta_pdf,0.6,0.1;
rhopie,0.5,beta_pdf,0.6,0.1;
//shocks,stdevs
stderr eepspi,0.10,inv_gamma_pdf,0.3,2;
stderr eepsy,0.50,inv_gamma_pdf,0.3,2;
stderr eepsr,0.22,inv_gamma_pdf,0.3,2;
stderr eepspie,0.25,inv_gamma_pdf,0.3,2;
end;

varobs inflobs outputobs ffrobs pieobs;//
//sample: 1982q1-2012q2

estimation(datafile=fyhu4_data,prefilter=1,first_obs=1, mode_compute=4,mode_check,mh_replic=0);% ycbo seems to work better
estimation(datafile=fyhu4_data,prefilter=1,first_obs=1,conf_sig=0.90,mh_nblocks=5,mh_jscale=0.2,mh_drop=0.5,mode_compute=4,mode_check,bayesian_irf,filtered_vars,forecast=40,mh_replic=200000); % ycbo seems to work better


The response of Matlab is:

VarSampleMoments :: not enough data to initialize! Try to increase FirstObservation.
Error using +
Matrix dimensions must agree.

Error in dsge_var_likelihood (line 200)
tmp0 =
dsge_prior_weight*DynareDataset.info.ntobs*TheoreticalAutoCovarianceOfTheObservedVariables(:,:,1)
+ mYY ;

Error in initial_estimation_checks (line 47)
[fval,junk1,junk2,a,b,c,d] =
feval(objective_function,xparam1,DynareDataset,DynareOptions,Model,EstimatedParameters,BayesInfo,DynareResults);

Error in dynare_estimation_1 (line 179)
oo_ =
initial_estimation_checks(objective_function,xparam1,dataset_,M_,estim_params_,options_,bayestopt_,oo_);

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

Error in an (line 230)
dynare_estimation(var_list_);

Error in dynare (line 180)
evalin('base',fname) ;
Ina
 
Posts: 15
Joined: Tue Jul 09, 2013 6:36 pm

Re: dsge__var

Postby jpfeifer » Mon Sep 22, 2014 2:13 pm

Please post the datafile. Which Dynare version are you using?
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: dsge__var

Postby Ina » Mon Sep 22, 2014 2:23 pm

I am using dynare 4.4.0. Her is the data file
Attachments
fyhu4_data.m
(13.47 KiB) Downloaded 118 times
Ina
 
Posts: 15
Joined: Tue Jul 09, 2013 6:36 pm

Re: dsge__var

Postby Ina » Mon Sep 22, 2014 2:31 pm

Sorry, it's a dynare 4.4.3
Ina
 
Posts: 15
Joined: Tue Jul 09, 2013 6:36 pm

Re: dsge__var

Postby jpfeifer » Tue Sep 23, 2014 5:03 am

The VAR-part has 4 lags that need to be initialized using a training sample. When you specify
Code: Select all
first_obs=1

you are telling Dynare to use observation -3 to 0 which do not exist. Thus, Dynare tells you to use at least
Code: Select all
first_obs=5

When you change this, everything should work.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: dsge__var

Postby Ina » Tue Sep 23, 2014 3:59 pm

ok, thanks it works.
Ina
 
Posts: 15
Joined: Tue Jul 09, 2013 6:36 pm

Re: dsge__var

Postby Ina » Wed Sep 24, 2014 8:13 am

Hi, I have 2 questions.
Firts, which of the solid and dashed lines corrisponds to dsge and vars(sorry, it's the first time that i'm trying a dsge_var estimation)?

Second, why this model works with dsge_var estimation but when I try the model whithout dsge_var it doesn't work?
Ina
 
Posts: 15
Joined: Tue Jul 09, 2013 6:36 pm

Re: dsge__var

Postby jpfeifer » Wed Sep 24, 2014 11:43 am

1. See Pfeifer (2014): An Introduction to Graphs in Dynare at https://sites.google.com/site/pfeiferecon/dynare
2. You need to be more precise. What is the problem?
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: dsge__var

Postby Ina » Wed Sep 24, 2014 12:22 pm

The problem is that comes out the priors and mode check plots and then stop runing:

Error using chol
Matrix must be positive definite.

Error in metropolis_hastings_initialization (line 68)
d = chol(vv);

Error in random_walk_metropolis_hastings (line 62)
[ ix2, ilogpo2, ModelName, MetropolisFolder, fblck, fline, npar, nblck, nruns, NewFile, MAX_nruns, d ]
= ...

Error in dynare_estimation_1 (line 782)
feval(options_.posterior_sampling_method,objective_function,options_.proposal_distribution,xparam1,invhess,bounds,dataset_,options_,M_,estim_params_,bayestopt_,oo_);

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

Error in fusa21 (line 270)
dynare_estimation(var_list_);

Error in dynare (line 180)
evalin('base',fname) ;
Ina
 
Posts: 15
Joined: Tue Jul 09, 2013 6:36 pm

Re: dsge__var

Postby jpfeifer » Wed Sep 24, 2014 12:56 pm

Search the forum on this one. There are dozens of posts on this.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 4 guests

cron