beta version of UG for web

git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1316 ac1d8469-bf42-47a9-8791-bf33cf982152
time-shift
tommaso 2007-06-13 15:19:43 +00:00
parent 1af967a313
commit b566d29bd7
17 changed files with 700 additions and 793 deletions

View File

@ -1,102 +1,97 @@
\relax
\citation{Schorfheide2000}
\citation{CogleyNason1994}
\@writefile{lof}{\addvspace {10pt}}
\@writefile{lot}{\addvspace {10pt}}
\@writefile{toc}{\contentsline {chapter}{\chapternumberline {6}Estimating DSGE models - advanced topics}{57}{chapter.6}}
\newlabel{ch:estadv}{{\M@TitleReference {6}{Estimating DSGE models - advanced topics}}{57}{\relax }{chapter.6}{}}
\@writefile{toc}{\contentsline {section}{\numberline {6.1}A complete, complex and non-stationary example}{57}{section.6.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {6.1.1}Introducing the example}{57}{subsection.6.1.1}}
\citation{Schorfheide2000}
\newlabel{fig:schorfmod}{{\M@TitleReference {6.1.1}{Introducing the example}}{58}{Introducing the example\relax }{subsection.6.1.1}{}}
\@writefile{lof}{\contentsline {figure}{\numberline {6.1}{\ignorespaces CIA model illustration}}{58}{figure.6.1}}
\citation{Hamilton1994}
\citation{CogleyNason1994}
\@writefile{toc}{\contentsline {subsection}{\numberline {6.1.2}Declaring variables and parameters}{61}{subsection.6.1.2}}
\citation{CogleyNason1994}
\@writefile{toc}{\contentsline {subsection}{\numberline {6.1.3}The origin of non-stationarity}{62}{subsection.6.1.3}}
\newlabel{sec:nonstat}{{\M@TitleReference {6.1.3}{The origin of non-stationarity}}{62}{The origin of non-stationarity\relax }{subsection.6.1.3}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {6.1.4}Stationarizing variables}{62}{subsection.6.1.4}}
\@writefile{toc}{\contentsline {subsection}{\numberline {6.1.5}Linking stationary variables to the data}{63}{subsection.6.1.5}}
\@writefile{toc}{\contentsline {subsection}{\numberline {6.1.6}The resulting model block of the .mod file}{63}{subsection.6.1.6}}
\@writefile{toc}{\contentsline {subsection}{\numberline {6.1.7}Declaring observable variables}{64}{subsection.6.1.7}}
\citation{DurbinKoopman2001}
\@writefile{toc}{\contentsline {subsection}{\numberline {6.1.8}Declaring trends in observable variables}{65}{subsection.6.1.8}}
\@writefile{toc}{\contentsline {subsection}{\numberline {6.1.9}Declaring unit roots in observable variables}{65}{subsection.6.1.9}}
\@writefile{toc}{\contentsline {subsection}{\numberline {6.1.10}Specifying the steady state}{66}{subsection.6.1.10}}
\@writefile{toc}{\contentsline {subsection}{\numberline {6.1.11}Declaring priors}{66}{subsection.6.1.11}}
\@writefile{toc}{\contentsline {subsection}{\numberline {6.1.12}Launching the estimation}{66}{subsection.6.1.12}}
\@writefile{toc}{\contentsline {subsection}{\numberline {6.1.13}The complete .mod file}{67}{subsection.6.1.13}}
\citation{Schorfheide2000}
\newlabel{fig:estsumm}{{\M@TitleReference {6.1.14}{Summing it up}}{69}{Summing it up\relax }{subsection.6.1.14}{}}
\@writefile{lof}{\contentsline {figure}{\numberline {6.2}{\ignorespaces Steps of model estimation}}{69}{figure.6.2}}
\@writefile{toc}{\contentsline {subsection}{\numberline {6.1.14}Summing it up}{69}{subsection.6.1.14}}
\@writefile{toc}{\contentsline {section}{\numberline {6.2}Comparing models based on their posterior distributions}{69}{section.6.2}}
\@writefile{toc}{\contentsline {section}{\numberline {6.3}Comparing output to BVARs}{69}{section.6.3}}
\@writefile{toc}{\contentsline {section}{\numberline {6.4}Where is your output stored?}{69}{section.6.4}}
\@setckpt{ch-estadv}{
\setcounter{page}{70}
\setcounter{equation}{0}
\setcounter{enumi}{12}
\setcounter{enumii}{0}
\setcounter{enumiii}{0}
\setcounter{enumiv}{0}
\setcounter{footnote}{2}
\setcounter{mpfootnote}{0}
\setcounter{storedpagenumber}{1}
\setcounter{part}{0}
\setcounter{chapter}{6}
\setcounter{section}{4}
\setcounter{subsection}{0}
\setcounter{subsubsection}{0}
\setcounter{paragraph}{0}
\setcounter{subparagraph}{0}
\setcounter{@ppsavesec}{0}
\setcounter{@ppsaveapp}{0}
\setcounter{vslineno}{0}
\setcounter{poemline}{0}
\setcounter{modulo@vs}{0}
\setcounter{verse}{0}
\setcounter{chrsinstr}{0}
\setcounter{poem}{0}
\setcounter{newflo@tctr}{4}
\setcounter{@contsubnum}{0}
\setcounter{maxsecnumdepth}{2}
\setcounter{sheetsequence}{78}
\setcounter{lastsheet}{96}
\setcounter{lastpage}{90}
\setcounter{bvlinectr}{0}
\setcounter{cp@cntr}{0}
\setcounter{ism@mctr}{0}
\setcounter{xsm@mctr}{0}
\setcounter{csm@mctr}{0}
\setcounter{ksm@mctr}{0}
\setcounter{xksm@mctr}{0}
\setcounter{cksm@mctr}{0}
\setcounter{msm@mctr}{0}
\setcounter{xmsm@mctr}{0}
\setcounter{cmsm@mctr}{0}
\setcounter{bsm@mctr}{0}
\setcounter{workm@mctr}{0}
\setcounter{figure}{2}
\setcounter{lofdepth}{1}
\setcounter{lofdepth}{1}
\setcounter{table}{0}
\setcounter{lotdepth}{1}
\setcounter{lotdepth}{1}
\setcounter{book}{0}
\setcounter{pagenote}{0}
\setcounter{lofdepth}{1}
\setcounter{lotdepth}{1}
\setcounter{parentequation}{0}
\setcounter{r@tfl@t}{0}
\setcounter{NAT@ctr}{0}
\setcounter{Item}{58}
\setcounter{memhycontfloat}{0}
\setcounter{definition}{0}
\setcounter{lemma}{0}
\setcounter{property}{0}
\setcounter{theorem}{0}
\setcounter{remark}{0}
\setcounter{section@level}{1}
}
\relax
\citation{Schorfheide2000}
\citation{CogleyNason1994}
\@writefile{lof}{\addvspace {10pt}}
\@writefile{lot}{\addvspace {10pt}}
\@writefile{toc}{\contentsline {chapter}{\chapternumberline {6}Estimating DSGE models - advanced topics}{61}{chapter.6}}
\newlabel{ch:estadv}{{6}{61}{\@empty \relax }{chapter.6}{}}
\@writefile{toc}{\contentsline {section}{\numberline {6.1}Alternative and non-stationary example}{61}{section.6.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {6.1.1}Introducing the example}{61}{subsection.6.1.1}}
\citation{Schorfheide2000}
\newlabel{fig:schorfmod}{{6.1.1}{62}{\@empty \relax }{subsection.6.1.1}{}}
\@writefile{lof}{\contentsline {figure}{\numberline {6.1}{\ignorespaces CIA model illustration}}{62}{figure.6.1}}
\citation{Hamilton1994}
\citation{CogleyNason1994}
\@writefile{toc}{\contentsline {subsection}{\numberline {6.1.2}Declaring variables and parameters}{66}{subsection.6.1.2}}
\@writefile{toc}{\contentsline {subsection}{\numberline {6.1.3}The origin of non-stationarity}{66}{subsection.6.1.3}}
\newlabel{sec:nonstat}{{6.1.3}{66}{\@empty \relax }{subsection.6.1.3}{}}
\citation{CogleyNason1994}
\@writefile{toc}{\contentsline {subsection}{\numberline {6.1.4}Stationarizing variables}{67}{subsection.6.1.4}}
\@writefile{toc}{\contentsline {subsection}{\numberline {6.1.5}Linking stationary variables to the data}{68}{subsection.6.1.5}}
\@writefile{toc}{\contentsline {subsection}{\numberline {6.1.6}The resulting model block of the .mod file}{68}{subsection.6.1.6}}
\@writefile{toc}{\contentsline {subsection}{\numberline {6.1.7}Declaring observable variables}{69}{subsection.6.1.7}}
\@writefile{toc}{\contentsline {subsection}{\numberline {6.1.8}Declaring trends in observable variables}{69}{subsection.6.1.8}}
\citation{DurbinKoopman2001}
\@writefile{toc}{\contentsline {subsection}{\numberline {6.1.9}Declaring unit roots in observable variables}{70}{subsection.6.1.9}}
\@writefile{toc}{\contentsline {subsection}{\numberline {6.1.10}Specifying the steady state}{71}{subsection.6.1.10}}
\@writefile{toc}{\contentsline {subsection}{\numberline {6.1.11}Declaring priors}{71}{subsection.6.1.11}}
\@writefile{toc}{\contentsline {subsection}{\numberline {6.1.12}Launching the estimation}{71}{subsection.6.1.12}}
\@writefile{toc}{\contentsline {subsection}{\numberline {6.1.13}The complete .mod file}{72}{subsection.6.1.13}}
\citation{Schorfheide2000}
\newlabel{fig:estsumm}{{6.1.14}{74}{\@empty \relax }{subsection.6.1.14}{}}
\@writefile{lof}{\contentsline {figure}{\numberline {6.2}{\ignorespaces Steps of model estimation}}{74}{figure.6.2}}
\@writefile{toc}{\contentsline {subsection}{\numberline {6.1.14}Summing it up}{74}{subsection.6.1.14}}
\@writefile{toc}{\contentsline {section}{\numberline {6.2}Comparing models based on their posterior distributions}{74}{section.6.2}}
\@writefile{toc}{\contentsline {section}{\numberline {6.3}Where is your output stored?}{75}{section.6.3}}
\@setckpt{ch-estadv}{
\setcounter{page}{76}
\setcounter{equation}{0}
\setcounter{enumi}{12}
\setcounter{enumii}{0}
\setcounter{enumiii}{0}
\setcounter{enumiv}{0}
\setcounter{footnote}{2}
\setcounter{mpfootnote}{0}
\setcounter{storedpagenumber}{1}
\setcounter{part}{0}
\setcounter{chapter}{6}
\setcounter{section}{3}
\setcounter{subsection}{0}
\setcounter{subsubsection}{0}
\setcounter{paragraph}{0}
\setcounter{subparagraph}{0}
\setcounter{@ppsavesec}{0}
\setcounter{@ppsaveapp}{0}
\setcounter{vslineno}{0}
\setcounter{poemline}{0}
\setcounter{modulo@vs}{0}
\setcounter{verse}{0}
\setcounter{chrsinstr}{0}
\setcounter{newflo@tctr}{4}
\setcounter{@contsubnum}{0}
\setcounter{maxsecnumdepth}{2}
\setcounter{sheetsequence}{84}
\setcounter{lastsheet}{106}
\setcounter{lastpage}{98}
\setcounter{bvlinectr}{0}
\setcounter{cp@cntr}{0}
\setcounter{ism@mctr}{0}
\setcounter{xsm@mctr}{0}
\setcounter{csm@mctr}{0}
\setcounter{ksm@mctr}{0}
\setcounter{xksm@mctr}{0}
\setcounter{cksm@mctr}{0}
\setcounter{msm@mctr}{0}
\setcounter{xmsm@mctr}{0}
\setcounter{cmsm@mctr}{0}
\setcounter{bsm@mctr}{0}
\setcounter{workm@mctr}{0}
\setcounter{figure}{2}
\setcounter{lofdepth}{1}
\setcounter{lofdepth}{1}
\setcounter{table}{0}
\setcounter{lotdepth}{1}
\setcounter{lotdepth}{1}
\setcounter{parentequation}{0}
\setcounter{r@tfl@t}{0}
\setcounter{NAT@ctr}{0}
\setcounter{Item}{57}
\setcounter{definition}{0}
\setcounter{lemma}{0}
\setcounter{property}{0}
\setcounter{theorem}{0}
\setcounter{remark}{0}
\setcounter{lofdepth}{1}
\setcounter{lotdepth}{1}
\setcounter{section@level}{0}
}

View File

@ -102,7 +102,7 @@ parameters alp, bet, gam, mst, rho, psi, del;}\\
where the choice of upper and lower case letters is not significant, the first set of endogenous variables, up to $l$, are as specified in the model setup above, and where the last five variables are defined and explained in more details in the section below on declaring the model in Dynare. The exogenous variables are as expected and concern the shocks to the evolution of technology and money balances. \\
\subsection{The origin of non-stationarity} \label{sec:nonstat}
The problem of non-stationarity comes out clearly when attempting to solve the model for a steady state and realizing it does not have one. It can be shown that when shocks are null, real variables grow with $A_t$ (except for labor, $N_t$, which is stationary as there is no population growth), nominal variables grow with $M_t$ and prices with $M_t/A_t$. \textbf{Detrending} therefore involves the following operations (where hats over variables represent stationary variables): for real variables, $\hat q_t=q_t/A_t$, where $q_t = [y_t, c_t, i_t, k_{t+1} ]$. For nominal variables, $\hat{Q}_t = Q_t/M_t$, where $Q_t = [ d_t, l_t, W_t ]$. And for prices, $\hat P_t = P_t \cdot A_t / M_t$. \\
The problem of non-stationarity comes from having stochastic trends in technology and money. The non-stationarity comes out clearly when attempting to solve the model for a steady state and realizing it does not have one. It can be shown that when shocks are null, real variables grow with $A_t$ (except for labor, $N_t$, which is stationary as there is no population growth), nominal variables grow with $M_t$ and prices with $M_t/A_t$. \textbf{Detrending} therefore involves the following operations (where hats over variables represent stationary variables): for real variables, $\hat q_t=q_t/A_t$, where $q_t = [y_t, c_t, i_t, k_{t+1} ]$. For nominal variables, $\hat{Q}_t = Q_t/M_t$, where $Q_t = [ d_t, l_t, W_t ]$. And for prices, $\hat P_t = P_t \cdot A_t / M_t$. \\
\subsection{Stationarizing variables}
Let's illustrate this transformation on output, and leave the transformations of the remaining equations as an exercise, if you wish (\citet{CogleyNason1994} includes more details on the transformations of each equation). We stationarize output by dividing its real variables (except for labor) by $A_t$. We define $\widehat{Y}_t$ to equal $Y_t / A_t$ and $\widehat{K}_t$ as $K_t / A_t$. \textsf{\textbf{NOTE!}} Recall from section \ref{sec:modspe} in chapter \ref{ch:solbase}), that in Dynare variables take the time subscript of the period in which they are decided (in the case of the capital stock, today's capital stock is a result of yesterday's decision). Thus, in the output equation, we should actually work with $\widehat{K}_{t-1}=K_{t-1} / A_{t-1}$. The resulting equation made up of stationary variables is
@ -125,17 +125,17 @@ The other equations are entered into the .mod file after transforming them in ex
by simply taking the exponential of both sides of the stochastic process of technology defined in the model setup above. \\
\subsection{Linking stationary variables to the data}
And finally, we must make a decision as to our \textbf{non-stationary observations}. We could simply stationarize them by \textbf{working with rates of growth} (which we know are constant). In the case of output, the observable variable would become $Y_t /Y_{t-1}$. We would then have to relate this observable, call it $gy\_obs$ to our (stationary) model's variables $\widehat Y_t$ by using the definition that $ \widehat{Y}_t \equiv Y_t/ A_t$. Thus, we add to the model block of the .mod file: \\
And finally, we must make a decision as to our \textbf{non-stationary observations}. We could simply stationarize them by \textbf{working with rates of growth} (which we know are constant). In the case of output, the observable variable would become $Y_t /Y_{t-1}$. We would then have to relate this observable, call it $gy\_{obs}$, to our (stationary) model's variables $\widehat Y_t$ by using the definition that $ \widehat{Y}_t \equiv Y_t/ A_t$. Thus, we add to the model block of the .mod file: \\
\\
\texttt{gy\_obs = dA*y/y(-1);}\\
\\
where, the $y$ of the .mod file are the stationary $\widehat Y_t$.\\
But, we could also \textbf{work with non-stationary data in levels}. This complicates things somewhat, but illustrates several features of Dynare worth highlighting; we therefore follow this path in the remainder of the example. The result is not very different, though, from what we just saw above. The goal is to add a line to the model block of our .mod file that relates the non stationary observables, call them $Y_obs$, to our stationary output, $\widehat Y_t$. We could simply write $Y_obs = \widehat Y_t A_t$. But since we don't have an $A_t$ variable, but just a $dA_t$, we we-write the above relationship in ratios. To the .mod file, we therefore add:\\
But, we could also \textbf{work with non-stationary data in levels}. This complicates things somewhat, but illustrates several features of Dynare worth highlighting; we therefore follow this path in the remainder of the example. The result is not very different, though, from what we just saw above. The goal is to add a line to the model block of our .mod file that relates the non stationary observables, call them $Y_{obs}$, to our stationary output, $\widehat Y_t$. We could simply write $Y_{obs} = \widehat Y_t A_t$. But since we don't have an $A_t$ variable, but just a $dA_t$, we we-write the above relationship in ratios. To the .mod file, we therefore add:\\
\\
\texttt{Y\_obs/Y\_obs(-1) = dA*y/y(-1);}\\
\\
We of course do the same for prices, our other observable variable, except that we use the relationship $P_obs = \widehat P_t M_t/A_t$ as noted earlier. The details of the correct transformations for prices are left as an exercise and can be checked against the results below.\\
We of course do the same for prices, our other observable variable, except that we use the relationship $P_{obs} = \widehat P_t M_t/A_t$ as noted earlier. The details of the correct transformations for prices are left as an exercise and can be checked against the results below.\\
\subsection{The resulting model block of the .mod file}
@ -168,7 +168,7 @@ We begin by declaring which of our model's variables are observables. In our .mo
\\
\texttt{varobs P\_obs Y\_obs;}\\
\\
to specify that our observable variables are indeed P\_obs and Y\_obs as noted in the section above. \textsf{\textbf{NOTE!}} The number of unobserved variables (number of \texttt{var} minus number of \texttt{varobs}) must be smaller or equal to the number of shocks such that the model be estimated (** is this true?). If this is not the case, you should add measurement shocks to your model where you deem most appropriate. \\
to specify that our observable variables are indeed $P\_obs$ and $Y\_obs$ as noted in the section above. \textsf{\textbf{NOTE!}} Recall from earlier that the number of observed variables must be smaller or equal to the number of shocks such that the model be estimated. If this is not the case, you should add measurement shocks to your model where you deem most appropriate. \\
\subsection{Declaring trends in observable variables}
@ -188,7 +188,7 @@ Note from the original equation of motion of $\ln m_t$ that in steady state, $\l
In Dynare, any trends, whether deterministic or stochastic (the drift term) must be declared up front. In the case of our example, we therefore write (in a somewhat cumbersome manner)\\
\\
\texttt{observation\_trends;\\
P\_obs (log(exp(gam)/mst));\\
P\_obs (log(mst)-gam);\\
Y\_obs (gam);\\
end;}\\
@ -198,12 +198,12 @@ In general, the command \texttt{observation\_trends} specifies linear trends as
And finally, since P\_obs and Y\_obs inherit the unit root characteristics of their driving variables, technology and money, we must tell Dynare to use a diffuse prior (infinite variance) for their initialization in the Kalman filter. Note that for stationary variables, the unconditional covariance matrix of these variables is used for initialization. The algorithm to compute a true diffuse prior is taken from \citet{DurbinKoopman2001}. To give these instructions to Dynare, we write in the .mod\\
\\
\texttt{unit\_root\_vars = \{'P\_obs'; 'Y\_obs' \};}\\
\texttt{unit\_root\_vars P\_obs Y\_obs;}\\
\\
\textsf{\textbf{NOTE!}} You don't need to declare unit roots for any non-stationary model. Unit roots are only related to stochastic trends. You don't need to use a diffuse initial condition in the case of a deterministic trend, since the variance is finite.\\
\subsection{Specifying the steady state}
Declaring the steady state is just as explained in details and according to the same syntax explained in chapter \ref{ch:solbase}, covering the \texttt{initval}, \texttt{steady} and \texttt{check} commands. The only difference with regards to model estimation is the non-stationary nature of our observable variables. In this case, the declaration of the steady state must be slightly amended in Dynare. (** fill in with the new functionality from Dynare version 4, currently the answer is to write a separate Matlab file which solves the steady state for the stationary variables and returns dummies for the non stationary variables).
Declaring the steady state is just as explained in details and according to the same syntax explained in chapter \ref{ch:solbase}, covering the \texttt{initval}, \texttt{steady} and \texttt{check} commands. In chapter \ref{ch:estbase}, section \ref{sec:ssest}, we also discussed the usefulness of providing an external Matlab file to solve for the steady state. In this case, you can find the corresponding steady state file in the \textsl{models} folder under \textsl{UserGuide}. The file is called \textsl{fs2000ns\_steadystate.m}. There are some things to notice. First, the output of the function is the endogenous variables at steady state, the \texttt{ys} vector. The \texttt{check=0} limits steady state values to real numbers. Second, notice the declaration of parameters at the beginning; intuitive, but tedious... This functionality may be updated in later versions of Dynare. Third, note that the file is really only a sequential set of equalities, defining each variable in terms of parameters or variables solved in the lines above. So far, nothing has changed with respect to the equivalent file of chapter \ref{ch:estbase}. The only novelty is the declaration of the non-stationary variables, $P\_obs$ and $Y\_obs$ which take the value of 1. This is Dynare convention and must be the case for all your non-stationary variables.
\subsection{Declaring priors}
We expand our .mod file with the following information: \\
@ -224,13 +224,13 @@ end;}\\
\subsection{Launching the estimation}
We add the following commands to ask Dynare to run a basic estimation of our model:\\
\\
\texttt{estimation(datafile=fsdat,nobs=192,loglinear,mh\_replic=5000,\\
mh\_nblocks=5,mh\_drop=0.45,mh\_jscale=0.8);}\\
\texttt{estimation(datafile=fsdat,nobs=192,loglinear,mh\_replic=2000,\\
mode\_compute=4,mh\_nblocks=2,mh\_drop=0.45,mh\_jscale=0.65);}\\
\textsf{\textbf{NOTE!}} As mentioned earlier, we need to instruct Dynare to log-linearize our model, since it contains non-linear equations in non-stationary variables. A simple linearization would fail as these variables do not have a steady state. Fortunately, taking the log of the equations involving non-stationary variables does the job of linearizing them.\\
\subsection{The complete .mod file}
We have seen each part of the .mod separately; it's now time to get a picture of what the complete file looks like. For convenience, the file also appears in the ``examples'' folder of your Dynare installation, under \texttt{fs2000l.mod}. (** rewrite and replace example file. Also, make sure the .mod below works given the slightly rearranged order of each block. Finally, change the initval block below with the appropriate commands for Dynare version 4, with respect to the non stationary variables). \\
We have seen each part of the .mod separately; it's now time to get a picture of what the complete file looks like. For convenience, the file also appears in the \textsl{models} folder under \textsl{UserGuide} in your Dynare installation. The file is called \texttt{fs2000ns.mod}. \\
\\
\texttt{var m P c e W R k d n l Y\_obs P\_obs y dA; \\
varexo e\_a e\_m;\\
@ -258,11 +258,11 @@ end;\\
varobs P\_obs Y\_obs;\\
\\
observation\_trends;\\
P\_obs (log(exp(gam)/mst));\\
P\_obs (log(mst)-gam);\\
Y\_obs (gam);\\
end;\\
\\
unit\_root\_vars = \{'P\_obs'; 'Y\_obs' \};\\
unit\_root\_vars = P\_obs Y\_obs;\\
\\
initval;\\
k = 6;\\
@ -279,9 +279,11 @@ y = 0.6;\\
dA = exp(gam);\\
end;\\
\\
steady;\\
// the above is really only useful if you want to do a stoch\_simul\\
// of your model, since the estimation will use the Matlab\\
// steady state file also provided and discussed above.\\
\\
check;\\
steady;\\
\\
estimated\_params;\\
alp, beta\_pdf, 0.356, 0.02; \\
@ -295,8 +297,8 @@ stderr e\_a, inv\_gamma\_pdf, 0.035449, inf;\\
stderr e\_m, inv\_gamma\_pdf, 0.008862, inf;\\
end;\\
\\
estimation(datafile=fsdat,nobs=192,loglinear,mh\_replic=5000,\\
mh\_nblocks=5,mh\_drop=0.45,mh\_jscale=0.8);}\\
estimation(datafile=fsdat,nobs=192,loglinear,mh\_replic=2000,\\
mode\_compute=4,mh\_nblocks=2,mh\_drop=0.45,mh\_jscale=0.65);}\\
\\
\subsection{Summing it up}
@ -309,13 +311,8 @@ The explanations given above of each step necessary to translate the \citet{Scho
\end{figure}\\
\section{Comparing models based on their posterior distributions}
** TBD using StŽphane's examples and model\_compare command which still needs to be documented.
\section{Comparing output to BVARs}
** TBD based on completed documentation from Michel and StŽphane.
** TBD
\section{Where is your output stored?}
** TBD with a table and info from Dynare v.4
The output from estimation can be extremely varied, depending on the instructions you give Dynare. The \href{http://www.cepremap.cnrs.fr/juillard/mambo/download/manual/index.html}{Reference Manual} overviews the complete set of potential output files and describes where you can find each one.

View File

@ -1,85 +1,81 @@
\relax
\@writefile{lof}{\addvspace {10pt}}
\@writefile{lot}{\addvspace {10pt}}
\@writefile{toc}{\contentsline {chapter}{\chapternumberline {5}Estimating DSGE models - basics}{45}{chapter.5}}
\newlabel{ch:estbase}{{\M@TitleReference {5}{Estimating DSGE models - basics}}{45}{\relax }{chapter.5}{}}
\@writefile{toc}{\contentsline {section}{\numberline {5.1}Introducing an example}{45}{section.5.1}}
\newlabel{sec:modsetup}{{\M@TitleReference {5.1}{Introducing an example}}{45}{Introducing an example\relax }{section.5.1}{}}
\@writefile{toc}{\contentsline {section}{\numberline {5.2}Declaring variables and parameters}{46}{section.5.2}}
\@writefile{toc}{\contentsline {section}{\numberline {5.3}Declaring the model}{46}{section.5.3}}
\@writefile{toc}{\contentsline {section}{\numberline {5.4}Declaring observable variables}{47}{section.5.4}}
\@writefile{toc}{\contentsline {section}{\numberline {5.5}Specifying the steady state}{47}{section.5.5}}
\@writefile{toc}{\contentsline {section}{\numberline {5.6}Declaring priors}{47}{section.5.6}}
\@writefile{toc}{\contentsline {section}{\numberline {5.7}Launching the estimation}{49}{section.5.7}}
\newlabel{sec:estimate}{{\M@TitleReference {5.7}{Launching the estimation}}{49}{Launching the estimation\relax }{section.5.7}{}}
\@writefile{toc}{\contentsline {section}{\numberline {5.8}The complete .mod file}{53}{section.5.8}}
\@writefile{toc}{\contentsline {section}{\numberline {5.9}Interpreting output}{54}{section.5.9}}
\@writefile{toc}{\contentsline {subsection}{\numberline {5.9.1}Tabular results}{54}{subsection.5.9.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {5.9.2}Graphical results}{55}{subsection.5.9.2}}
\@writefile{toc}{\contentsline {section}{\numberline {5.10}Dealing with non-stationary models}{56}{section.5.10}}
\@setckpt{ch-estbase}{
\setcounter{page}{57}
\setcounter{equation}{0}
\setcounter{enumi}{23}
\setcounter{enumii}{0}
\setcounter{enumiii}{0}
\setcounter{enumiv}{0}
\setcounter{footnote}{0}
\setcounter{mpfootnote}{0}
\setcounter{storedpagenumber}{1}
\setcounter{part}{0}
\setcounter{chapter}{5}
\setcounter{section}{10}
\setcounter{subsection}{0}
\setcounter{subsubsection}{0}
\setcounter{paragraph}{0}
\setcounter{subparagraph}{0}
\setcounter{@ppsavesec}{0}
\setcounter{@ppsaveapp}{0}
\setcounter{vslineno}{0}
\setcounter{poemline}{0}
\setcounter{modulo@vs}{0}
\setcounter{verse}{0}
\setcounter{chrsinstr}{0}
\setcounter{poem}{0}
\setcounter{newflo@tctr}{4}
\setcounter{@contsubnum}{0}
\setcounter{maxsecnumdepth}{2}
\setcounter{sheetsequence}{65}
\setcounter{lastsheet}{96}
\setcounter{lastpage}{90}
\setcounter{bvlinectr}{0}
\setcounter{cp@cntr}{0}
\setcounter{ism@mctr}{0}
\setcounter{xsm@mctr}{0}
\setcounter{csm@mctr}{0}
\setcounter{ksm@mctr}{0}
\setcounter{xksm@mctr}{0}
\setcounter{cksm@mctr}{0}
\setcounter{msm@mctr}{0}
\setcounter{xmsm@mctr}{0}
\setcounter{cmsm@mctr}{0}
\setcounter{bsm@mctr}{0}
\setcounter{workm@mctr}{0}
\setcounter{figure}{0}
\setcounter{lofdepth}{1}
\setcounter{lofdepth}{1}
\setcounter{table}{0}
\setcounter{lotdepth}{1}
\setcounter{lotdepth}{1}
\setcounter{book}{0}
\setcounter{pagenote}{0}
\setcounter{lofdepth}{1}
\setcounter{lotdepth}{1}
\setcounter{parentequation}{0}
\setcounter{r@tfl@t}{0}
\setcounter{NAT@ctr}{0}
\setcounter{Item}{46}
\setcounter{memhycontfloat}{0}
\setcounter{definition}{0}
\setcounter{lemma}{0}
\setcounter{property}{0}
\setcounter{theorem}{0}
\setcounter{remark}{0}
\setcounter{section@level}{1}
}
\relax
\@writefile{lof}{\addvspace {10pt}}
\@writefile{lot}{\addvspace {10pt}}
\@writefile{toc}{\contentsline {chapter}{\chapternumberline {5}Estimating DSGE models - basics}{47}{chapter.5}}
\newlabel{ch:estbase}{{5}{47}{\@empty \relax }{chapter.5}{}}
\@writefile{toc}{\contentsline {section}{\numberline {5.1}Introducing an example}{47}{section.5.1}}
\newlabel{sec:modsetup}{{5.1}{47}{\@empty \relax }{section.5.1}{}}
\@writefile{toc}{\contentsline {section}{\numberline {5.2}Declaring variables and parameters}{48}{section.5.2}}
\@writefile{toc}{\contentsline {section}{\numberline {5.3}Declaring the model}{48}{section.5.3}}
\@writefile{toc}{\contentsline {section}{\numberline {5.4}Declaring observable variables}{49}{section.5.4}}
\@writefile{toc}{\contentsline {section}{\numberline {5.5}Specifying the steady state}{49}{section.5.5}}
\newlabel{sec:ssest}{{5.5}{49}{\@empty \relax }{section.5.5}{}}
\@writefile{toc}{\contentsline {section}{\numberline {5.6}Declaring priors}{49}{section.5.6}}
\@writefile{toc}{\contentsline {section}{\numberline {5.7}Launching the estimation}{52}{section.5.7}}
\newlabel{sec:estimate}{{5.7}{52}{\@empty \relax }{section.5.7}{}}
\@writefile{toc}{\contentsline {section}{\numberline {5.8}The complete .mod file}{55}{section.5.8}}
\@writefile{toc}{\contentsline {section}{\numberline {5.9}Interpreting output}{57}{section.5.9}}
\@writefile{toc}{\contentsline {subsection}{\numberline {5.9.1}Tabular results}{57}{subsection.5.9.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {5.9.2}Graphical results}{57}{subsection.5.9.2}}
\@setckpt{ch-estbase}{
\setcounter{page}{60}
\setcounter{equation}{0}
\setcounter{enumi}{22}
\setcounter{enumii}{0}
\setcounter{enumiii}{0}
\setcounter{enumiv}{0}
\setcounter{footnote}{0}
\setcounter{mpfootnote}{0}
\setcounter{storedpagenumber}{1}
\setcounter{part}{0}
\setcounter{chapter}{5}
\setcounter{section}{9}
\setcounter{subsection}{2}
\setcounter{subsubsection}{0}
\setcounter{paragraph}{0}
\setcounter{subparagraph}{0}
\setcounter{@ppsavesec}{0}
\setcounter{@ppsaveapp}{0}
\setcounter{vslineno}{0}
\setcounter{poemline}{0}
\setcounter{modulo@vs}{0}
\setcounter{verse}{0}
\setcounter{chrsinstr}{0}
\setcounter{newflo@tctr}{4}
\setcounter{@contsubnum}{0}
\setcounter{maxsecnumdepth}{2}
\setcounter{sheetsequence}{68}
\setcounter{lastsheet}{106}
\setcounter{lastpage}{98}
\setcounter{bvlinectr}{0}
\setcounter{cp@cntr}{0}
\setcounter{ism@mctr}{0}
\setcounter{xsm@mctr}{0}
\setcounter{csm@mctr}{0}
\setcounter{ksm@mctr}{0}
\setcounter{xksm@mctr}{0}
\setcounter{cksm@mctr}{0}
\setcounter{msm@mctr}{0}
\setcounter{xmsm@mctr}{0}
\setcounter{cmsm@mctr}{0}
\setcounter{bsm@mctr}{0}
\setcounter{workm@mctr}{0}
\setcounter{figure}{0}
\setcounter{lofdepth}{1}
\setcounter{lofdepth}{1}
\setcounter{table}{0}
\setcounter{lotdepth}{1}
\setcounter{lotdepth}{1}
\setcounter{parentequation}{0}
\setcounter{r@tfl@t}{0}
\setcounter{NAT@ctr}{0}
\setcounter{Item}{45}
\setcounter{definition}{0}
\setcounter{lemma}{0}
\setcounter{property}{0}
\setcounter{theorem}{0}
\setcounter{remark}{0}
\setcounter{lofdepth}{1}
\setcounter{lotdepth}{1}
\setcounter{section@level}{0}
}

View File

@ -37,7 +37,7 @@ This should not come as a surprise. Dynare must know which variables are observa
\\
\texttt{varobs Y;}\\
\section{Specifying the steady state}
\section{Specifying the steady state} \label{sec:ssest}
Before Dynare estimates a model, it first linearizes it around a steady state. Thus, a steady state must exist for the model and although Dynare can calculate it, we must give it a hand by declaring approximate values for the steady state. This is just as explained in details and according to the same syntax outlined in chapter \ref{ch:solbase}, covering the \texttt{initval}, \texttt{steady} and \texttt{check} commands. In fact, as this chapter uses the same model as that outlined in chapter \ref{ch:solbase}, the steady state block will look exactly the same.\\
\textsf{\textbf{TIP!}} During estimation, in finding the posterior mode, Dynare recalculates the steady state of the model at each iteration of the optimization routine (more on this later), based on the newest round of parameters available. Thus, by providing approximate initial values and relying solely on the built-in Dynare algorithm to find the steady state (a numerical procedure), you will significantly slow down the computation of the posterior mode. Dynare will end up spending 60 to 70\% of the time recalculating steady states. It is much more efficient to write an external \textbf{Matlab steady state file} and let Dynare use that file to find the steady state of your model by algebraic procedure. For more details on writing an external Matlab file to find your model's steady state, please refer to section \ref{sec:findsteady} of chapter \ref{ch:solbase}. \\
@ -87,9 +87,9 @@ Coming back to our basic example, we would write:\\
alpha, beta\_pdf, 0.35, 0.02; \\
beta, beta\_pdf, 0.99, 0.002; \\
delta, beta\_pdf, 0.025, 0.003;\\
psi, beta\_pdf, 1.75, 0.02;\\
psi, gamma\_pdf, 1.75, 0.02;\\
rho, beta\_pdf, 0.95, 0.05;\\
epsilon, beta\_pdf, 10, 0.003;\\
epsilon, gamma\_pdf, 10, 0.003;\\
stderr e, inv\_gamma\_pdf, 0.01, inf;\\
end;}\\
@ -125,12 +125,12 @@ for each estimated parameter in turn. This is helpful to diagnose problems with
of starting from scratch. Again, this is a useful option to speed up the process of estimation.
\item nodiagnostic: doesnÕt compute the convergence diagnostics for Metropolis-Hastings (default: diagnostics are computed and
displayed). Actually seeing if the various blocks of Metropolis-Hastings runs converge is a powerful and useful option to build confidence in your model estimation. More details on these diagnostics are given in Chapter \ref{ch:estadv}.
\item bayesian\_irf: triggers the computation of the posterior distribution of impulse response functions (IRFs). The length of the IRFs are controlled by the irf option, as specified in chapter \ref{ch:solbase} when discussing the options for \texttt{stoch\_simul}. To build the posterior distribution of the IRFs, Dynare pulls parameter and shock values from the corresponding estimated distributions and, for each set of draws, generates an IRF. Repeating this process often enough generates a distribution of IRFs. \textsf{\textbf{TIP!}} If you stop the estimation procedure after calculating the posterior mode, or carry out maximum likelihood estimation, only the corresponding parameter estimates will be used to generate the IRFs. If you instead carry out a full Metropolis-Hastings estimation, on the other hand, the IRFs will use the parameters at the posterior mean, including the variance of the shocks.
\item bayesian\_irf: triggers the computation of the posterior distribution of impulse response functions (IRFs). The length of the IRFs are controlled by the irf option, as specified in chapter \ref{ch:solbase} when discussing the options for \texttt{stoch\_simul}. To build the posterior distribution of the IRFs, Dynare pulls parameter and shock values from the corresponding estimated distributions and, for each set of draws, generates an IRF. Repeating this process often enough generates a distribution of IRFs. \textsf{\textbf{TIP!}} If you stop the estimation procedure after calculating the posterior mode, or carry out maximum likelihood estimation, only the corresponding parameter estimates will be used to generate the IRFs. If you instead carry out a full Metropolis-Hastings estimation, on the other hand, the IRFs will use the parameters the posterior distributions, including the variance of the shocks.
\item All options available for stoch\_simul can simply be added to the above options, separated by commas. To view a list of these options, either see the \href{http://www.cepremap.cnrs.fr/juillard/mambo/index.php?option=com_content&task=view&id=51&Itemid=84}{Reference Manual} or section \ref{sec:compute} of chapter \ref{ch:solbase}.
\item moments\_varendo: triggers the computation of the posterior distribution of the theoretical moments of the endogenous variables as in \texttt{stoch\_simul} (the posterior distribution of the variance decomposition is also included). ** will be implemented shortly - if not already - in Dynare version 4.
\item filtered\_vars: triggers the computation of the posterior distribution of filtered endogenous variables and shocks. See the note below on the difference between filtered and smoothed shocks. ** will be implemented shortly - if not already - in Dynare version 4.
\item smoother: triggers the computation of the posterior distribution of smoothed endogenous variables and shocks. Smoothed shocks are a reconstruction of the values of unobserved shocks over the sample, using all the information contained in the sample of observations. Filtered shocks, instead, are built only based on knowing past information. To calculate one period ahead prediction errors, for instance, you should use filtered, not smoothed variables.
\item forecast = INTEGER: computes the posterior distribution of a forecast on INTEGER periods after the end of the sample used in estimation. The corresponding graph includes one confidence interval describing uncertainty due to parameters and one confidence interval describing uncertainty due to parameters and future shocks. Note that Dynare cannot forecast out of the posterior mode. You need to run Metropolis-Hastings iterations before being able to run forecasts on an estimated model. Finally, running a forecast is very similar to an IRF, as in \texttt{bayesian\_irf}, except that the forecast does not begin at a steady state, but simply at the point corresponding to the last set of observations. The point of the forecast is to see how the system returns to steady state from this starting point. Of course, as observation do not exist for all variables, those for the remaining variables are reconstructed by sampling out of the posterior distribution of parameters. Again, repeating this step often enough yields a posterior distribution of the forecast. ** will be implemented shortly - if not already - in Dynare version 4.
\item forecast = INTEGER: computes the posterior distribution of a forecast on INTEGER periods after the end of the sample used in estimation. The corresponding graph includes one confidence interval describing uncertainty due to parameters and one confidence interval describing uncertainty due to parameters and future shocks. Note that Dynare cannot forecast out of the posterior mode. You need to run Metropolis-Hastings iterations before being able to run forecasts on an estimated model. Finally, running a forecast is very similar to an IRF, as in \texttt{bayesian\_irf}, except that the forecast does not begin at a steady state, but simply at the point corresponding to the last set of observations. The goal of undertaking a forecast is to see how the system returns to steady state from this starting point. Of course, as observation do not exist for all variables, those necessary are reconstructed by sampling out of the posterior distribution of parameters. Again, repeating this step often enough yields a posterior distribution of the forecast. ** will be implemented shortly - if not already - in Dynare version 4.
\end{enumerate}
\textsf{\textbf{TIP!}} Before launching estimation it is a good idea to make sure that your model is correctly declared, that a steady state exists and that it can be simulated for at least one set of parameter values. You may therefore want to create a test version of your .mod file. In this test file, you would comment out or erase the commands related to estimation, remove the prior estimates for parameter values and replace them with actual parameter values in the preamble, remove any non-stationary variables from your model, add a \texttt{shocks} block, make sure you have \texttt{steady} and possibly \texttt{check} following the \texttt{initval} block if you do not have exact steady state values and run a simulation using \texttt{stoch\_simul} at the end of your .mod file. Details on model solution and simulation can be found in Chapter \ref{ch:solbase}. \\
@ -143,7 +143,7 @@ mh\_replic=2000,mh\_nblocks=2,mh\_drop=0.45,mh\_jscale=0.8); }\\
This ends our description of the .mod file.
\section{The complete .mod file}
To summarize and to get a complete perspective on our work so far, here is the complete .mod file for the estimation of our very basic model:\\
To summarize and to get a complete perspective on our work so far, here is the complete .mod file for the estimation of our very basic model. You can find the corresponding file in the \textsl{models} folder under \textsl{UserGuide} in your installation of Dynare. The file is called \textsl{RBC\_Est.mod}.\\
\\
\texttt{var y c k i l y\_l w r z;\\
varexo e;\\
@ -182,16 +182,16 @@ estimated\_params;\\
alpha, beta\_pdf, 0.35, 0.02; \\
beta, beta\_pdf, 0.99, 0.002; \\
delta, beta\_pdf, 0.025, 0.003;\\
psi, beta\_pdf, 1.75, 0.02;\\
psi, gamma\_pdf, 1.75, 0.02;\\
rho, beta\_pdf, 0.95, 0.05;\\
epsilon, beta\_pdf, 10, 0.003;\\
epsilon, gamma\_pdf, 10, 0.003;\\
stderr e, inv\_gamma\_pdf, 0.01, inf;\\
end;\\
\\
estimation(datafile=simuldataRBC,nobs=200,first\_obs=500,\\
mh\_replic=2000,mh\_nblocks=2,mh\_drop=0.45,mh\_jscale=0.8); }
\\
(** problem: file doesn't work! See RBC\_DataGen.mod and RBC\_Est.mod)
\section{Interpreting output}
@ -217,7 +217,7 @@ In our example above, you can tell that indeed, we obtain convergence and relati
\textsf{\textbf{TIP!}} If the plotted moments are highly unstable or do not converge, you may have a problem of poor priors. It is advisable to redo the estimation with different priors. If you have trouble coming up with a new prior, try starting with a uniform and relatively wide prior and see where the data leads the posterior distribution. Another approach is to undertake a greater number of Metropolis-Hastings simulations.\\
The first to last figure - figure 6 in our example - displays the most interesting set of results, towards which most of the computations undertaken by Dynare are directed: the posterior distribution. In fact, the figure compares the posterior to the prior distribution (black vs. grey lines). In addition, on the posterior distribution, Dynare plots a green line which represents the posterior mode.\\
The first to last figure - figure 6 in our example - displays the most interesting set of results, towards which most of the computations undertaken by Dynare are directed: the posterior distribution. In fact, the figure compares the posterior to the prior distribution (black vs. grey lines). In addition, on the posterior distribution, Dynare plots a green line which represents the posterior mode. These allow you to make statements about your data other than simply concerning the mean and variance of the parameters; you can also discuss the probability that your parameter is larger or smaller than a certain value.\\
\textsf{\textbf{TIP!}} These graphs are of course especially relevant and present key results, but they can also serve as tools to detect problems or build additional confidence in your results. First, the prior and the posterior distributions should not be excessively different. Second, the posterior distributions should be close to normal, or at least not display a shape that is clearly non-normal. Third, the green mode (calculated from the numerical optimization of the posterior kernel) should not be too far away from the mode of the posterior distribution. If not, it is advisable to undertake a greater number of Metropolis-Hastings simulations. \\

View File

@ -7,17 +7,15 @@ This chapter focuses on the theory of Bayesian estimation. It begins by motivati
Bayesian estimation is becoming increasingly popular in the field of macro-economics. Recent papers have attracted significant attention; some of these include: \citet{Schorfheide2000} which uses Bayesian methods to compare the fit of two competing DSGE models of consumption, \citet{LubikSchorfheide2003} which investigates whether central banks in small open economies respond to exchange rate movements, \citet{SmetsWouters2003} which applies Bayesian estimation techniques to a model of the Eurozone, \citet{Ireland2004} which emphasizes instead maximum likelihood estimation, \citet{VillaverdeRubioRamirez2004} which reviews the econometric properties of Bayesian estimators and compare estimation results with maximum likelihood and BVAR methodologies, \citet{LubikSchorfheide2005} which applies Bayesian estimation methods to an open macro model focussing on issues of misspecification and identification, and finally \citet{RabanalRubioRamirez2005} which compares the fit, based on posterior distributions, of four competing specifications of New Keynesian monetary models with nominal rigidities.\\
There are a multitude of advantages of using Bayesian methods to estimate a model, but six of these stand out as particularly important and general enough to mention here.\\
There are a multitude of advantages of using Bayesian methods to estimate a model, but five of these stand out as particularly important and general enough to mention here.\\
First, Bayesian estimation fits the complete, solved DSGE model, as opposed to GMM estimation which is based on particular equilibrium relationships such as the Euler equation in consumption.\\
First, Bayesian estimation fits the complete, solved DSGE model, as opposed to GMM estimation which is based on particular equilibrium relationships such as the Euler equation in consumption. Likewise, estimation in the Bayesian case is based on the likelihood generated by the DSGE system, rather than the more indirect discrepancy between the implied DSGE and VAR impulse response functions. Of course, if your model is entirely mis-specified, estimating it using Bayesian techniques could be a disadvantage.\\
Second, estimation in the Bayesian case is based on the likelihood generated by the DSGE system, rather than the more indirect discrepancy between the implied DSGE and VAR impulse response functions.\\
Second, Bayesian techniques allow the consideration of priors which work as weights in the estimation process so that the posterior distribution avoids peaking at strange points where the likelihood peaks. Indeed, due to the stylized and often misspecified nature of DSGE models, the likelihood often peaks in regions of the parameter space that are contradictory with common observations, leading to the ``dilemma of absurd parameter estimates''.\\
Third, Bayesian techniques allow the consideration of priors which work as weights in the estimation process so that the posterior distribution avoids peaking at strange points where the likelihood peaks. Indeed, due to the stylized and often misspecified nature of DSGE models, the likelihood often peaks in regions of the parameter space that are contradictory with common observations, leading to the ``dilemma of absurd parameter estimates''.\\
Third, the inclusion of priors also helps identifying parameters. Unfortunately, when estimating a model, the problem of identification often arises. It can be summarized by different values of structural parameters leading to the same joint distribution for observables. More technically, the problem arises when the posterior distribution is flat over a subspace of parameter values. But the weighting of the likelihood with prior densities often leads to adding just enough curvature in the posterior distribution to facilitate numerical maximization.\\
Fourth, the inclusion of priors also helps identifying parameters. Unfortunately, when estimating a model, the problem of identification often arises. It can be summarized by different values of structural parameters leading to the same joint distribution for observables. More technically, the problem arises when the posterior distribution is flat over a subspace of parameter values. But the weighting of the likelihood with prior densities often leads to adding just enough curvature in the posterior distribution to facilitate numerical maximization.\\
Fifth, Bayesian estimation explicitly addresses model misspecification by including shocks, which can be interpreted as observational errors, in the structural equations.\\
Fourth, Bayesian estimation explicitly addresses model misspecification by including shocks, which can be interpreted as observation errors, in the structural equations.\\
Sixth, Bayesian estimation naturally leads to the comparison of models based on fit. Indeed, the posterior distribution corresponding to competing models can easily be used to determine which model best fits the data. This procedure, as other topics mentioned above, is discussed more technically in the subsection below.
@ -175,10 +173,10 @@ The general idea of the Metropolis-Hastings algorithm is to simulate the posteri
\]
\end{enumerate}
Figure \ref{fig:MH} tries to clarify the above. In step 1, choose a candidate paramter, $\theta^*$ from a Normal distribution, whose mean has been set to $\theta^{t-1}$ (this will become clear in just a moment). In step 2, compute the value of the posterior kernel for that candidate parameter, and compare it to the value of the kernel from the mean of the drawing distribution. In step 3, decide whether or not to hold on to your candidate parameter. If the acceptance ratio is greater than one, then definitely keep your candidate. Otherwise, go back to the candidate of last period (this is true in very coarse terms, notice that in fact you would keep your candidate only with a probability less than one). Then, do two things. Update the mean of your drawing distribution, and note the value of the parameter your retain. In step 4, start building a histogram of those retained values. That is what figure \ref{fig:MH} is supposed to illustrate. Of course, the point is for each ``bucket'' of the histogram to shrink to zero. This ``smoothed histogram'' will eventually be the posterior distribution after sufficient iterations of the above steps.\\
Figure \ref{fig:MH} tries to clarify the above. In step 1, choose a candidate paramter, $\theta^*$ from a Normal distribution, whose mean has been set to $\theta^{t-1}$ (this will become clear in just a moment). In step 2, compute the value of the posterior kernel for that candidate parameter, and compare it to the value of the kernel from the mean of the drawing distribution. In step 3, decide whether or not to hold on to your candidate parameter. If the acceptance ratio is greater than one, then definitely keep your candidate. Otherwise, go back to the candidate of last period (this is true in very coarse terms, notice that in fact you would keep your candidate only with a probability less than one). Then, do two things. Update the mean of your drawing distribution, and note the value of the parameter your retain. After having repeated these steps often enough, in the final step, build a histogram of those retained values. Of course, the point is for each ``bucket'' of the histogram to shrink to zero. This ``smoothed histogram'' will eventually be the posterior distribution after sufficient iterations of the above steps.\\
\begin{figure} \label{fig:MH}
\begin{center}
\includegraphics[width=1.0\textwidth]{P_MH}
\includegraphics[width=1.0\textwidth]{P_MH2}
\end{center}
\caption[Illustration of the Metropolis-Hastings algorithm]{The above sketches the Metropolis-Hastings algorithm, used to build the posterior distribution function. Imagine repeating these steps a large number of times, and smoothing the ``histogram'' such that each ``bucket'' has infinitely small width.}
\end{figure}

View File

@ -1,76 +1,72 @@
\relax
\@writefile{lof}{\addvspace {10pt}}
\@writefile{lot}{\addvspace {10pt}}
\@writefile{toc}{\contentsline {chapter}{\chapternumberline {2}Installing Dynare}{7}{chapter.2}}
\newlabel{ch:inst}{{\M@TitleReference {2}{Installing Dynare}}{7}{\relax }{chapter.2}{}}
\@writefile{toc}{\contentsline {section}{\numberline {2.1}Dynare versions}{7}{section.2.1}}
\@writefile{toc}{\contentsline {section}{\numberline {2.2}System requirements}{7}{section.2.2}}
\@writefile{toc}{\contentsline {section}{\numberline {2.3}Installing Dynare}{8}{section.2.3}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.3.1}Installing on Windows}{8}{subsection.2.3.1}}
\@writefile{toc}{\contentsline {section}{\numberline {2.4}Matlab particularities}{8}{section.2.4}}
\@setckpt{ch-inst}{
\setcounter{page}{9}
\setcounter{equation}{0}
\setcounter{enumi}{6}
\setcounter{enumii}{0}
\setcounter{enumiii}{0}
\setcounter{enumiv}{0}
\setcounter{footnote}{1}
\setcounter{mpfootnote}{0}
\setcounter{storedpagenumber}{1}
\setcounter{part}{0}
\setcounter{chapter}{2}
\setcounter{section}{4}
\setcounter{subsection}{0}
\setcounter{subsubsection}{0}
\setcounter{paragraph}{0}
\setcounter{subparagraph}{0}
\setcounter{@ppsavesec}{0}
\setcounter{@ppsaveapp}{0}
\setcounter{vslineno}{0}
\setcounter{poemline}{0}
\setcounter{modulo@vs}{0}
\setcounter{verse}{0}
\setcounter{chrsinstr}{0}
\setcounter{poem}{0}
\setcounter{newflo@tctr}{4}
\setcounter{@contsubnum}{0}
\setcounter{maxsecnumdepth}{2}
\setcounter{sheetsequence}{17}
\setcounter{lastsheet}{96}
\setcounter{lastpage}{90}
\setcounter{bvlinectr}{0}
\setcounter{cp@cntr}{0}
\setcounter{ism@mctr}{0}
\setcounter{xsm@mctr}{0}
\setcounter{csm@mctr}{0}
\setcounter{ksm@mctr}{0}
\setcounter{xksm@mctr}{0}
\setcounter{cksm@mctr}{0}
\setcounter{msm@mctr}{0}
\setcounter{xmsm@mctr}{0}
\setcounter{cmsm@mctr}{0}
\setcounter{bsm@mctr}{0}
\setcounter{workm@mctr}{0}
\setcounter{figure}{0}
\setcounter{lofdepth}{1}
\setcounter{lofdepth}{1}
\setcounter{table}{0}
\setcounter{lotdepth}{1}
\setcounter{lotdepth}{1}
\setcounter{book}{0}
\setcounter{pagenote}{0}
\setcounter{lofdepth}{1}
\setcounter{lotdepth}{1}
\setcounter{parentequation}{0}
\setcounter{r@tfl@t}{0}
\setcounter{NAT@ctr}{0}
\setcounter{Item}{6}
\setcounter{memhycontfloat}{0}
\setcounter{definition}{0}
\setcounter{lemma}{0}
\setcounter{property}{0}
\setcounter{theorem}{0}
\setcounter{remark}{0}
\setcounter{section@level}{1}
}
\relax
\@writefile{lof}{\addvspace {10pt}}
\@writefile{lot}{\addvspace {10pt}}
\@writefile{toc}{\contentsline {chapter}{\chapternumberline {2}Installing Dynare}{7}{chapter.2}}
\newlabel{ch:inst}{{2}{7}{\@empty \relax }{chapter.2}{}}
\@writefile{toc}{\contentsline {section}{\numberline {2.1}Dynare versions}{7}{section.2.1}}
\@writefile{toc}{\contentsline {section}{\numberline {2.2}System requirements}{7}{section.2.2}}
\@writefile{toc}{\contentsline {section}{\numberline {2.3}Installing Dynare}{8}{section.2.3}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.3.1}Installing on Windows}{8}{subsection.2.3.1}}
\@writefile{toc}{\contentsline {section}{\numberline {2.4}Matlab particularities}{8}{section.2.4}}
\@setckpt{ch-inst}{
\setcounter{page}{9}
\setcounter{equation}{0}
\setcounter{enumi}{6}
\setcounter{enumii}{0}
\setcounter{enumiii}{0}
\setcounter{enumiv}{0}
\setcounter{footnote}{1}
\setcounter{mpfootnote}{0}
\setcounter{storedpagenumber}{1}
\setcounter{part}{0}
\setcounter{chapter}{2}
\setcounter{section}{4}
\setcounter{subsection}{0}
\setcounter{subsubsection}{0}
\setcounter{paragraph}{0}
\setcounter{subparagraph}{0}
\setcounter{@ppsavesec}{0}
\setcounter{@ppsaveapp}{0}
\setcounter{vslineno}{0}
\setcounter{poemline}{0}
\setcounter{modulo@vs}{0}
\setcounter{verse}{0}
\setcounter{chrsinstr}{0}
\setcounter{newflo@tctr}{4}
\setcounter{@contsubnum}{0}
\setcounter{maxsecnumdepth}{2}
\setcounter{sheetsequence}{17}
\setcounter{lastsheet}{106}
\setcounter{lastpage}{98}
\setcounter{bvlinectr}{0}
\setcounter{cp@cntr}{0}
\setcounter{ism@mctr}{0}
\setcounter{xsm@mctr}{0}
\setcounter{csm@mctr}{0}
\setcounter{ksm@mctr}{0}
\setcounter{xksm@mctr}{0}
\setcounter{cksm@mctr}{0}
\setcounter{msm@mctr}{0}
\setcounter{xmsm@mctr}{0}
\setcounter{cmsm@mctr}{0}
\setcounter{bsm@mctr}{0}
\setcounter{workm@mctr}{0}
\setcounter{figure}{0}
\setcounter{lofdepth}{1}
\setcounter{lofdepth}{1}
\setcounter{table}{0}
\setcounter{lotdepth}{1}
\setcounter{lotdepth}{1}
\setcounter{parentequation}{0}
\setcounter{r@tfl@t}{0}
\setcounter{NAT@ctr}{0}
\setcounter{Item}{6}
\setcounter{definition}{0}
\setcounter{lemma}{0}
\setcounter{property}{0}
\setcounter{theorem}{0}
\setcounter{remark}{0}
\setcounter{lofdepth}{1}
\setcounter{lotdepth}{1}
\setcounter{section@level}{0}
}

View File

@ -8,14 +8,13 @@ This User Guide will exclusively \textbf{focus on the Matlab version of Dynare}.
You may also be interested by another version of Dynare, developed in parallel: \textbf{Dynare++}. This is a standalone C++ version of Dynare specialized in computing k-order approximations of dynamic stochastic general equilibrium models. See the \href{http://www.cepremap.cnrs.fr/juillard/mambo/index.php?option=com_content&task=view&id=53&Itemid=86}{Dynare++ webpage} for more information.
\section{System requirements}
Dynare can run on Windows, as well as Unix-like operating systems, such as any Linux distribution, Solaris and, of course, Mac OS X (** add compilation instructions). If you have questions about the support of a particular platform, feel free to write directly to Michel Juillard (michel.juillard"AT"ens.fr) or visit the \href{http://www.cepremap.cnrs.fr/juillard/mambo/index.php?option=com_forum&Itemid=95&page=viewforum&f=1}{\textbf{Dynare forums}}. \\
Dynare can run on Windows, as well as Unix-like operating systems, such as any Linux distribution, Solaris and, of course, Mac OS X. If you have questions about the support of a particular platform, feel free to write directly to Michel Juillard (michel.juillard"AT"ens.fr) or visit the \href{http://www.cepremap.cnrs.fr/juillard/mambo/index.php?option=com_forum&Itemid=95&page=viewforum&f=1}{\textbf{Dynare forums}}. \\
To run Dynare, it is recommended to allocate at least 256MB of RAM to the platform running Dynare, although 512MB is preferred. Depending on the type of computations required, like the very processor intensive Metropolis Hastings algorithm, you may need up to 1GB of RAM to obtain acceptable computational times. \\
\section{Installing Dynare}
\subsection{Installing on Windows}
The following assumes you have Matlab version 6.5.1 or later installed on your Windows system.\footnote{As of writing this Guide, Dynare is being developed on Matlab version 7. Nonetheless, great care is taken not to introduce features that would not work with reasonably recent versions of Matlab. However, Dynare requires at least the Matlab feature set of version 6.5.1, released September 22, 2003.}
\begin{enumerate}
The following assumes you have Matlab version 6.5.1 or later installed on your Windows system.\footnote{As of writing this Guide, Dynare is being developed on Matlab version 7. Nonetheless, great care is taken not to introduce features that would not work with reasonably recent versions of Matlab. However, Dynare requires at least the Matlab feature set of version 6.5.1, released September 22, 2003.} ** The current way to install Dynare version 4 may not yet be on par with the procedure described below. If a discrepancy exists, please follow downloading and installation instructions on the Dynare website. \begin{enumerate}
\item Download the latest stable version of Dynare for Matlab (Windows) from the \href{http://www.cepremap.cnrs.fr/juillard/mambo/index.php?option=com_frontpage&Itemid=1}{Dynare website}.
\item You will now have on your computer a .zip file which you should unzip. This will create a folder called, by default, Dynare and its version number, for example: Dynare\_v4.x (where $x$ stands for any subsequent upgrades).
\item This directory contains several sub-directories, among which (i) matlab, (ii) doc and (iii) examples.

View File

@ -1,78 +1,74 @@
\relax
\@writefile{lof}{\addvspace {10pt}}
\@writefile{lot}{\addvspace {10pt}}
\@writefile{toc}{\contentsline {chapter}{\chapternumberline {1}Introduction}{1}{chapter.1}}
\newlabel{ch:intro}{{\M@TitleReference {1}{Introduction}}{1}{\relax }{chapter.1}{}}
\@writefile{toc}{\contentsline {section}{\numberline {1.1}About this Guide - approach and structure}{1}{section.1.1}}
\@writefile{toc}{\contentsline {section}{\numberline {1.2}What is Dynare?}{2}{section.1.2}}
\newlabel{fig:dyn}{{\M@TitleReference {1.2}{What is Dynare?}}{3}{What is Dynare?\relax }{section.1.2}{}}
\@writefile{lof}{\contentsline {figure}{\numberline {1.1}{\ignorespaces Dynare, a bird's eyeview}}{3}{figure.1.1}}
\@writefile{toc}{\contentsline {section}{\numberline {1.3}Additional sources of help}{3}{section.1.3}}
\@writefile{toc}{\contentsline {section}{\numberline {1.4}Nomenclature}{4}{section.1.4}}
\@writefile{toc}{\contentsline {section}{\numberline {1.5}v4, what's new and backward compatibility}{5}{section.1.5}}
\@setckpt{ch-intro}{
\setcounter{page}{6}
\setcounter{equation}{0}
\setcounter{enumi}{0}
\setcounter{enumii}{0}
\setcounter{enumiii}{0}
\setcounter{enumiv}{0}
\setcounter{footnote}{0}
\setcounter{mpfootnote}{0}
\setcounter{storedpagenumber}{1}
\setcounter{part}{0}
\setcounter{chapter}{1}
\setcounter{section}{5}
\setcounter{subsection}{0}
\setcounter{subsubsection}{0}
\setcounter{paragraph}{0}
\setcounter{subparagraph}{0}
\setcounter{@ppsavesec}{0}
\setcounter{@ppsaveapp}{0}
\setcounter{vslineno}{0}
\setcounter{poemline}{0}
\setcounter{modulo@vs}{0}
\setcounter{verse}{0}
\setcounter{chrsinstr}{0}
\setcounter{poem}{0}
\setcounter{newflo@tctr}{4}
\setcounter{@contsubnum}{0}
\setcounter{maxsecnumdepth}{2}
\setcounter{sheetsequence}{14}
\setcounter{lastsheet}{96}
\setcounter{lastpage}{90}
\setcounter{bvlinectr}{0}
\setcounter{cp@cntr}{0}
\setcounter{ism@mctr}{0}
\setcounter{xsm@mctr}{0}
\setcounter{csm@mctr}{0}
\setcounter{ksm@mctr}{0}
\setcounter{xksm@mctr}{0}
\setcounter{cksm@mctr}{0}
\setcounter{msm@mctr}{0}
\setcounter{xmsm@mctr}{0}
\setcounter{cmsm@mctr}{0}
\setcounter{bsm@mctr}{0}
\setcounter{workm@mctr}{0}
\setcounter{figure}{1}
\setcounter{lofdepth}{1}
\setcounter{lofdepth}{1}
\setcounter{table}{0}
\setcounter{lotdepth}{1}
\setcounter{lotdepth}{1}
\setcounter{book}{0}
\setcounter{pagenote}{0}
\setcounter{lofdepth}{1}
\setcounter{lotdepth}{1}
\setcounter{parentequation}{0}
\setcounter{r@tfl@t}{0}
\setcounter{NAT@ctr}{0}
\setcounter{Item}{0}
\setcounter{memhycontfloat}{0}
\setcounter{definition}{0}
\setcounter{lemma}{0}
\setcounter{property}{0}
\setcounter{theorem}{0}
\setcounter{remark}{0}
\setcounter{section@level}{1}
}
\relax
\@writefile{lof}{\addvspace {10pt}}
\@writefile{lot}{\addvspace {10pt}}
\@writefile{toc}{\contentsline {chapter}{\chapternumberline {1}Introduction}{1}{chapter.1}}
\newlabel{ch:intro}{{1}{1}{\@empty \relax }{chapter.1}{}}
\@writefile{toc}{\contentsline {section}{\numberline {1.1}About this Guide - approach and structure}{1}{section.1.1}}
\@writefile{toc}{\contentsline {section}{\numberline {1.2}What is Dynare?}{2}{section.1.2}}
\newlabel{fig:dyn}{{1.2}{3}{\@empty \relax }{section.1.2}{}}
\@writefile{lof}{\contentsline {figure}{\numberline {1.1}{\ignorespaces Dynare, a bird's eyeview}}{3}{figure.1.1}}
\@writefile{toc}{\contentsline {section}{\numberline {1.3}Additional sources of help}{4}{section.1.3}}
\@writefile{toc}{\contentsline {section}{\numberline {1.4}Nomenclature}{5}{section.1.4}}
\@writefile{toc}{\contentsline {section}{\numberline {1.5}v4, what's new and backward compatibility}{5}{section.1.5}}
\@setckpt{ch-intro}{
\setcounter{page}{7}
\setcounter{equation}{0}
\setcounter{enumi}{0}
\setcounter{enumii}{0}
\setcounter{enumiii}{0}
\setcounter{enumiv}{0}
\setcounter{footnote}{0}
\setcounter{mpfootnote}{0}
\setcounter{storedpagenumber}{1}
\setcounter{part}{0}
\setcounter{chapter}{1}
\setcounter{section}{5}
\setcounter{subsection}{0}
\setcounter{subsubsection}{0}
\setcounter{paragraph}{0}
\setcounter{subparagraph}{0}
\setcounter{@ppsavesec}{0}
\setcounter{@ppsaveapp}{0}
\setcounter{vslineno}{0}
\setcounter{poemline}{0}
\setcounter{modulo@vs}{0}
\setcounter{verse}{0}
\setcounter{chrsinstr}{0}
\setcounter{newflo@tctr}{4}
\setcounter{@contsubnum}{0}
\setcounter{maxsecnumdepth}{2}
\setcounter{sheetsequence}{15}
\setcounter{lastsheet}{106}
\setcounter{lastpage}{98}
\setcounter{bvlinectr}{0}
\setcounter{cp@cntr}{0}
\setcounter{ism@mctr}{0}
\setcounter{xsm@mctr}{0}
\setcounter{csm@mctr}{0}
\setcounter{ksm@mctr}{0}
\setcounter{xksm@mctr}{0}
\setcounter{cksm@mctr}{0}
\setcounter{msm@mctr}{0}
\setcounter{xmsm@mctr}{0}
\setcounter{cmsm@mctr}{0}
\setcounter{bsm@mctr}{0}
\setcounter{workm@mctr}{0}
\setcounter{figure}{1}
\setcounter{lofdepth}{1}
\setcounter{lofdepth}{1}
\setcounter{table}{0}
\setcounter{lotdepth}{1}
\setcounter{lotdepth}{1}
\setcounter{parentequation}{0}
\setcounter{r@tfl@t}{0}
\setcounter{NAT@ctr}{0}
\setcounter{Item}{0}
\setcounter{definition}{0}
\setcounter{lemma}{0}
\setcounter{property}{0}
\setcounter{theorem}{0}
\setcounter{remark}{0}
\setcounter{lofdepth}{1}
\setcounter{lotdepth}{1}
\setcounter{section@level}{0}
}

View File

@ -35,7 +35,7 @@ In slightly less flowery words, it is a pre-processor and a collection of Matlab
\caption[Dynare, a bird's eyeview]{The .mod file being read by the Dynare pre-processor, which then calls the relevant Matlab routines to carry out the desired operations and display the results.}
\end{figure}
Figure \ref{fig:dyn} gives you an overview of the way Dynare works. Basically, the model and its related attributes, like a shock structure for instance, is written equation by equation in an editor of your choice. The resulting file will be called the .mod file. That file is then called from Matlab. This initiates the Dynare pre-processor which translates the .mod file into a suitable input for the Matlab routines (more precisely, it creates intermediary Matlab or C files which are then used by Matlab code) used to either solve or estimate the model. Finally, results are presented in Matlab.\\
Figure \ref{fig:dyn} gives you an overview of the way Dynare works. Basically, the model and its related attributes, like a shock structure for instance, is written equation by equation in an editor of your choice. The resulting file will be called the .mod file. That file is then called from Matlab. This initiates the Dynare pre-processor which translates the .mod file into a suitable input for the Matlab routines (more precisely, it creates intermediary Matlab or C files which are then used by Matlab code) used to either solve or estimate the model. Finally, results are presented in Matlab. Some more details on the internal files generated by Dynare is given in section \ref{sec:dynfiles} in chapter \ref{ch:soladv}. \\
Each of these steps will become clear as you read through the User Guide, but for now it may be helpful to summarize \textbf{what Dynare is able to do}:
\begin{itemize}

View File

@ -1,71 +1,67 @@
\relax
\@writefile{lof}{\addvspace {10pt}}
\@writefile{lot}{\addvspace {10pt}}
\@writefile{toc}{\contentsline {chapter}{\chapternumberline {9}Optimal policy under commitment}{85}{chapter.9}}
\newlabel{ch:ramsey}{{\M@TitleReference {9}{Optimal policy under commitment}}{85}{\relax }{chapter.9}{}}
\@setckpt{ch-ramsey}{
\setcounter{page}{86}
\setcounter{equation}{0}
\setcounter{enumi}{4}
\setcounter{enumii}{0}
\setcounter{enumiii}{0}
\setcounter{enumiv}{0}
\setcounter{footnote}{0}
\setcounter{mpfootnote}{0}
\setcounter{storedpagenumber}{1}
\setcounter{part}{0}
\setcounter{chapter}{9}
\setcounter{section}{0}
\setcounter{subsection}{0}
\setcounter{subsubsection}{0}
\setcounter{paragraph}{0}
\setcounter{subparagraph}{0}
\setcounter{@ppsavesec}{0}
\setcounter{@ppsaveapp}{0}
\setcounter{vslineno}{0}
\setcounter{poemline}{0}
\setcounter{modulo@vs}{0}
\setcounter{verse}{0}
\setcounter{chrsinstr}{0}
\setcounter{poem}{0}
\setcounter{newflo@tctr}{4}
\setcounter{@contsubnum}{0}
\setcounter{maxsecnumdepth}{2}
\setcounter{sheetsequence}{94}
\setcounter{lastsheet}{96}
\setcounter{lastpage}{90}
\setcounter{bvlinectr}{0}
\setcounter{cp@cntr}{0}
\setcounter{ism@mctr}{0}
\setcounter{xsm@mctr}{0}
\setcounter{csm@mctr}{0}
\setcounter{ksm@mctr}{0}
\setcounter{xksm@mctr}{0}
\setcounter{cksm@mctr}{0}
\setcounter{msm@mctr}{0}
\setcounter{xmsm@mctr}{0}
\setcounter{cmsm@mctr}{0}
\setcounter{bsm@mctr}{0}
\setcounter{workm@mctr}{0}
\setcounter{figure}{0}
\setcounter{lofdepth}{1}
\setcounter{lofdepth}{1}
\setcounter{table}{0}
\setcounter{lotdepth}{1}
\setcounter{lotdepth}{1}
\setcounter{book}{0}
\setcounter{pagenote}{0}
\setcounter{lofdepth}{1}
\setcounter{lotdepth}{1}
\setcounter{parentequation}{0}
\setcounter{r@tfl@t}{0}
\setcounter{NAT@ctr}{0}
\setcounter{Item}{62}
\setcounter{memhycontfloat}{0}
\setcounter{definition}{0}
\setcounter{lemma}{0}
\setcounter{property}{0}
\setcounter{theorem}{0}
\setcounter{remark}{0}
\setcounter{section@level}{1}
}
\relax
\@writefile{lof}{\addvspace {10pt}}
\@writefile{lot}{\addvspace {10pt}}
\@writefile{toc}{\contentsline {chapter}{\chapternumberline {9}Optimal policy under commitment}{93}{chapter.9}}
\newlabel{ch:ramsey}{{9}{93}{\@empty \relax }{chapter.9}{}}
\@setckpt{ch-ramsey}{
\setcounter{page}{94}
\setcounter{equation}{0}
\setcounter{enumi}{4}
\setcounter{enumii}{0}
\setcounter{enumiii}{0}
\setcounter{enumiv}{0}
\setcounter{footnote}{0}
\setcounter{mpfootnote}{0}
\setcounter{storedpagenumber}{1}
\setcounter{part}{0}
\setcounter{chapter}{9}
\setcounter{section}{0}
\setcounter{subsection}{0}
\setcounter{subsubsection}{0}
\setcounter{paragraph}{0}
\setcounter{subparagraph}{0}
\setcounter{@ppsavesec}{0}
\setcounter{@ppsaveapp}{0}
\setcounter{vslineno}{0}
\setcounter{poemline}{0}
\setcounter{modulo@vs}{0}
\setcounter{verse}{0}
\setcounter{chrsinstr}{0}
\setcounter{newflo@tctr}{4}
\setcounter{@contsubnum}{0}
\setcounter{maxsecnumdepth}{2}
\setcounter{sheetsequence}{102}
\setcounter{lastsheet}{106}
\setcounter{lastpage}{98}
\setcounter{bvlinectr}{0}
\setcounter{cp@cntr}{0}
\setcounter{ism@mctr}{0}
\setcounter{xsm@mctr}{0}
\setcounter{csm@mctr}{0}
\setcounter{ksm@mctr}{0}
\setcounter{xksm@mctr}{0}
\setcounter{cksm@mctr}{0}
\setcounter{msm@mctr}{0}
\setcounter{xmsm@mctr}{0}
\setcounter{cmsm@mctr}{0}
\setcounter{bsm@mctr}{0}
\setcounter{workm@mctr}{0}
\setcounter{figure}{0}
\setcounter{lofdepth}{1}
\setcounter{lofdepth}{1}
\setcounter{table}{0}
\setcounter{lotdepth}{1}
\setcounter{lotdepth}{1}
\setcounter{parentequation}{0}
\setcounter{r@tfl@t}{0}
\setcounter{NAT@ctr}{0}
\setcounter{Item}{61}
\setcounter{definition}{0}
\setcounter{lemma}{0}
\setcounter{property}{0}
\setcounter{theorem}{0}
\setcounter{remark}{0}
\setcounter{lofdepth}{1}
\setcounter{lotdepth}{1}
\setcounter{section@level}{0}
}

View File

@ -1,88 +1,85 @@
\relax
\@writefile{lof}{\addvspace {10pt}}
\@writefile{lot}{\addvspace {10pt}}
\@writefile{toc}{\contentsline {chapter}{\chapternumberline {4}Solving DSGE models - advanced topics}{35}{chapter.4}}
\newlabel{ch:soladv}{{\M@TitleReference {4}{Solving DSGE models - advanced topics}}{35}{\relax }{chapter.4}{}}
\@writefile{toc}{\contentsline {section}{\numberline {4.1}Dynare features and functionality}{35}{section.4.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {4.1.1}Other examples}{35}{subsection.4.1.1}}
\citation{CollardJuillard2003}
\@writefile{toc}{\contentsline {subsection}{\numberline {4.1.2}Alternative, complete example}{36}{subsection.4.1.2}}
\@writefile{toc}{\contentsline {subsubsection}{The model}{36}{section*.5}}
\@writefile{toc}{\contentsline {subsubsection}{The .mod file}{37}{section*.6}}
\@writefile{toc}{\contentsline {subsection}{\numberline {4.1.3}Finding, saving and viewing your output}{39}{subsection.4.1.3}}
\newlabel{sec:FindOut}{{\M@TitleReference {4.1.3}{Finding, saving and viewing your output}}{39}{Finding, saving and viewing your output\relax }{subsection.4.1.3}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {4.1.4}Referring to external files}{40}{subsection.4.1.4}}
\@writefile{toc}{\contentsline {subsection}{\numberline {4.1.5}Infinite eigenvalues}{40}{subsection.4.1.5}}
\@writefile{toc}{\contentsline {section}{\numberline {4.2}Files created by Dynare}{41}{section.4.2}}
\@writefile{toc}{\contentsline {section}{\numberline {4.3}Modeling tips}{41}{section.4.3}}
\@writefile{toc}{\contentsline {subsection}{\numberline {4.3.1}Stationarizing your model}{41}{subsection.4.3.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {4.3.2}Expectations taken in the past}{41}{subsection.4.3.2}}
\@writefile{toc}{\contentsline {subsection}{\numberline {4.3.3}Infinite sums}{41}{subsection.4.3.3}}
\citation{ClaridaGaliGertler1999}
\@writefile{toc}{\contentsline {subsection}{\numberline {4.3.4}Infinite sums with changing timing of expectations}{43}{subsection.4.3.4}}
\@setckpt{ch-soladv}{
\setcounter{page}{44}
\setcounter{equation}{0}
\setcounter{enumi}{7}
\setcounter{enumii}{0}
\setcounter{enumiii}{0}
\setcounter{enumiv}{0}
\setcounter{footnote}{0}
\setcounter{mpfootnote}{0}
\setcounter{storedpagenumber}{1}
\setcounter{part}{0}
\setcounter{chapter}{4}
\setcounter{section}{3}
\setcounter{subsection}{4}
\setcounter{subsubsection}{0}
\setcounter{paragraph}{0}
\setcounter{subparagraph}{0}
\setcounter{@ppsavesec}{0}
\setcounter{@ppsaveapp}{0}
\setcounter{vslineno}{0}
\setcounter{poemline}{0}
\setcounter{modulo@vs}{0}
\setcounter{verse}{0}
\setcounter{chrsinstr}{0}
\setcounter{poem}{0}
\setcounter{newflo@tctr}{4}
\setcounter{@contsubnum}{0}
\setcounter{maxsecnumdepth}{2}
\setcounter{sheetsequence}{52}
\setcounter{lastsheet}{96}
\setcounter{lastpage}{90}
\setcounter{bvlinectr}{0}
\setcounter{cp@cntr}{0}
\setcounter{ism@mctr}{0}
\setcounter{xsm@mctr}{0}
\setcounter{csm@mctr}{0}
\setcounter{ksm@mctr}{0}
\setcounter{xksm@mctr}{0}
\setcounter{cksm@mctr}{0}
\setcounter{msm@mctr}{0}
\setcounter{xmsm@mctr}{0}
\setcounter{cmsm@mctr}{0}
\setcounter{bsm@mctr}{0}
\setcounter{workm@mctr}{0}
\setcounter{figure}{0}
\setcounter{lofdepth}{1}
\setcounter{lofdepth}{1}
\setcounter{table}{0}
\setcounter{lotdepth}{1}
\setcounter{lotdepth}{1}
\setcounter{book}{0}
\setcounter{pagenote}{0}
\setcounter{lofdepth}{1}
\setcounter{lotdepth}{1}
\setcounter{parentequation}{0}
\setcounter{r@tfl@t}{0}
\setcounter{NAT@ctr}{0}
\setcounter{Item}{23}
\setcounter{memhycontfloat}{0}
\setcounter{definition}{0}
\setcounter{lemma}{0}
\setcounter{property}{0}
\setcounter{theorem}{0}
\setcounter{remark}{0}
\setcounter{section@level}{2}
}
\relax
\@writefile{lof}{\addvspace {10pt}}
\@writefile{lot}{\addvspace {10pt}}
\@writefile{toc}{\contentsline {chapter}{\chapternumberline {4}Solving DSGE models - advanced topics}{37}{chapter.4}}
\newlabel{ch:soladv}{{4}{37}{\@empty \relax }{chapter.4}{}}
\@writefile{toc}{\contentsline {section}{\numberline {4.1}Dynare features and functionality}{37}{section.4.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {4.1.1}Other examples}{37}{subsection.4.1.1}}
\citation{CollardJuillard2003}
\@writefile{toc}{\contentsline {subsection}{\numberline {4.1.2}Alternative, complete example}{38}{subsection.4.1.2}}
\@writefile{toc}{\contentsline {subsubsection}{The model}{38}{subsection.4.1.2}}
\@writefile{toc}{\contentsline {subsubsection}{The .mod file}{39}{subsection.4.1.2}}
\@writefile{toc}{\contentsline {subsection}{\numberline {4.1.3}Finding, saving and viewing your output}{41}{subsection.4.1.3}}
\newlabel{sec:FindOut}{{4.1.3}{41}{\@empty \relax }{subsection.4.1.3}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {4.1.4}Referring to external files}{42}{subsection.4.1.4}}
\@writefile{toc}{\contentsline {subsection}{\numberline {4.1.5}Infinite eigenvalues}{43}{subsection.4.1.5}}
\@writefile{toc}{\contentsline {section}{\numberline {4.2}Files created by Dynare}{43}{section.4.2}}
\newlabel{sec:dynfiles}{{4.2}{43}{\@empty \relax }{section.4.2}{}}
\@writefile{toc}{\contentsline {section}{\numberline {4.3}Modeling tips}{44}{section.4.3}}
\@writefile{toc}{\contentsline {subsection}{\numberline {4.3.1}Stationarizing your model}{44}{subsection.4.3.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {4.3.2}Expectations taken in the past}{44}{subsection.4.3.2}}
\@writefile{toc}{\contentsline {subsection}{\numberline {4.3.3}Infinite sums}{44}{subsection.4.3.3}}
\citation{ClaridaGaliGertler1999}
\@writefile{toc}{\contentsline {subsection}{\numberline {4.3.4}Infinite sums with changing timing of expectations}{46}{subsection.4.3.4}}
\@setckpt{ch-soladv}{
\setcounter{page}{47}
\setcounter{equation}{0}
\setcounter{enumi}{7}
\setcounter{enumii}{0}
\setcounter{enumiii}{0}
\setcounter{enumiv}{0}
\setcounter{footnote}{0}
\setcounter{mpfootnote}{0}
\setcounter{storedpagenumber}{1}
\setcounter{part}{0}
\setcounter{chapter}{4}
\setcounter{section}{3}
\setcounter{subsection}{4}
\setcounter{subsubsection}{0}
\setcounter{paragraph}{0}
\setcounter{subparagraph}{0}
\setcounter{@ppsavesec}{0}
\setcounter{@ppsaveapp}{0}
\setcounter{vslineno}{0}
\setcounter{poemline}{0}
\setcounter{modulo@vs}{0}
\setcounter{verse}{0}
\setcounter{chrsinstr}{0}
\setcounter{newflo@tctr}{4}
\setcounter{@contsubnum}{0}
\setcounter{maxsecnumdepth}{2}
\setcounter{sheetsequence}{55}
\setcounter{lastsheet}{106}
\setcounter{lastpage}{98}
\setcounter{bvlinectr}{0}
\setcounter{cp@cntr}{0}
\setcounter{ism@mctr}{0}
\setcounter{xsm@mctr}{0}
\setcounter{csm@mctr}{0}
\setcounter{ksm@mctr}{0}
\setcounter{xksm@mctr}{0}
\setcounter{cksm@mctr}{0}
\setcounter{msm@mctr}{0}
\setcounter{xmsm@mctr}{0}
\setcounter{cmsm@mctr}{0}
\setcounter{bsm@mctr}{0}
\setcounter{workm@mctr}{0}
\setcounter{figure}{0}
\setcounter{lofdepth}{1}
\setcounter{lofdepth}{1}
\setcounter{table}{0}
\setcounter{lotdepth}{1}
\setcounter{lotdepth}{1}
\setcounter{parentequation}{0}
\setcounter{r@tfl@t}{0}
\setcounter{NAT@ctr}{0}
\setcounter{Item}{23}
\setcounter{definition}{0}
\setcounter{lemma}{0}
\setcounter{property}{0}
\setcounter{theorem}{0}
\setcounter{remark}{0}
\setcounter{lofdepth}{1}
\setcounter{lotdepth}{1}
\setcounter{section@level}{0}
}

View File

@ -83,7 +83,7 @@ var u = 0.009 $\hat{}$ 2;\\
var e, u = phi*0.009*0.009;\\
end;}\\
So that you can gain experience by manipulating the entire model, here is the complete .mod file corresponding to the above example:\\
So that you can gain experience by manipulating the entire model, here is the complete .mod file corresponding to the above example. You can find the corresponding file in the \textsl{models} folder under \textsl{UserGuide} in your installation of Dynare. The file is called \textsl{Alt\_Ex1.mod}. \\
\\
\\
\texttt{var y, c, k, a, h, b;\\
@ -133,8 +133,8 @@ Where is output stored? Most of the moments of interest are stored in global var
\item \texttt{steady\_state}: the steady state of your variables
\item \texttt{mean}: the mean of your variables
\item \texttt{var}: the variance of your variables
\item \texttt{autocorr}: the various autocorrelation matrices of your variables. Each row of these matrices will correspond to a variables in time $t$, and columns correspond to the variables lagged 1, for the first matrix, then lagged 2 for the second matrix, and so on. Thus, the matrix of autocorrelations that is automatically displayed in the results after running \texttt{stoch\_simul} has the diagonal elements of each autocorrelation matrix running down each column.
\item \texttt{gamma\_y}: the matrices of autocovariances. \texttt{gamma\_y\{1\}} represents variances, while \texttt{gamma\_y\{2\}} represents autocovariances with a lag of 1 and so on. By default, Dynare will return autocovariances with a lag of 5. The last matrix (\texttt{gamma\_y\{7\}} in the default case) returns the \textbf{variance decomposition}, where each column captures the independent contribution of each shock to the variance of each variable.
\item \texttt{autocorr}: the various autocorrelation matrices of your variables. Each row of these matrices will correspond to a variables in time $t$, and columns correspond to the variables lagged 1, for the first matrix, then lagged 2 for the second matrix, and so on. Thus, the matrix of autocorrelations that is automatically displayed in the results after running \texttt{stoch\_simul} has, running down each column, the diagonal elements of each of the various autocorrelation matrices described here.
\item \texttt{gamma\_y}: the matrices of autocovariances. \texttt{gamma\_y\{1\}} represents variances, while \texttt{gamma\_y\{2\}} represents autocovariances where variables on each column are lagged by one period and so on. By default, Dynare will return autocovariances with a lag of 5. The last matrix (\texttt{gamma\_y\{7\}} in the default case) returns the \textbf{variance decomposition}, where each column captures the independent contribution of each shock to the variance of each variable.
\end{itemize}
Furthermore, if you decide to run impulse response functions, you will find a global variable \texttt{oo\_.irfs} comprising of vectors named \texttt{endogenous variable\_exogenous variable}, like \texttt{y\_e}, reporting the values of the endogenous variables corresponding to the impulse response functions, as a result of the independent impulse of each exogenous shock. \\
@ -150,9 +150,43 @@ But of course, this is a bit of a workaround, since you could also use the built
\subsection{Infinite eigenvalues}
If you use the command \texttt{check} in your .mod file, Dynare will report your system's eigenvalues and tell you if these meet the Blanchard-Kahn conditions. At that point, don't worry if you get infinite eigenvalues - these are are firmly grounded in the theory of generalized eigenvalues. They have no detrimental influence on the solution algorithm. As far as Blanchard-Kahn conditions are concerned infinite eigenvalues are counted as explosive roots of modulus larger than one. \\
\section{Files created by Dynare}
At times, you may get a message that there is an error in a file with a new name, or you may want to have a closer look at how Dynare actually solves your model - out of curiosity or maybe to do some customization of your own. You may therefore find it helpful to get a brief overview of the internal files that Dynare generates and the function of each one. ** TBD
\section{Files created by Dynare} \label{sec:dynfiles}
At times, you may get a message that there is an error in a file with a new name, or you may want to have a closer look at how Dynare actually solves your model - out of curiosity or maybe to do some customization of your own. You may therefore find it helpful to get a brief overview of the internal files that Dynare generates and the function of each one. \\
The dynare pre-processors essentially does three successive tasks:
(i) parsing of the mod file (it checks that the mod file is syntactically
correct), and its translation into internal machine representation (in
particular, model equations are translated into expression trees), (ii) symbolic derivation of the model equations, up to the needed order
(depending on the computing needs), (iii) outputting of several files, which are used from matlab. If the mod
file is ``filename.mod", then the pre-processor creates the following
files:
\begin{itemize}
\item \textbf{filename.m}: a matlab file containing several instructions, notably
the parameter initializations and the matlab calls corresponding to
computing tasks
\item \textbf{filename\_dynamic.m}: a matlab file containing the model equations and
their derivatives (first, second and maybe third).
Endogenous variables (resp. exogenous variables, parameters) are
contained in a ``y" (resp. ``x", ``params") vector, with an index number
depending on the declaration order.
The ``y" vector has as many entries as their are (variable, lag)
pairs in the declared model.
The model equations residuals are stored in a vector named
``residuals".
The model jacobian is put in ``g1" matrix. Second (resp. third)
derivatives are in ``g2" matrix (resp. ``g3").
If the ``use\_dll" option has been specified in the model declaration,
the pre-processor will output a C file (with .c extension) rather than a
matlab file. It is then compiled to create a library (DLL) file. Using a
compiled C file is supposed to give better computing performance in
model simulation/estimation.
\item \textbf{filename\_static.m}: a matlab file containing the stationarized
version of the model (i.e. where lagged variables are replaced by
current variables), with its jacobian. Used to compute the steady state.
Same notations than the dynamic file. Replaced by a C file when
``use\_dll" option is specified.
\end{itemize}
\section{Modeling tips}

View File

@ -1,116 +1,112 @@
\relax
\@writefile{lof}{\addvspace {10pt}}
\@writefile{lot}{\addvspace {10pt}}
\@writefile{toc}{\contentsline {chapter}{\chapternumberline {3}Solving DSGE models - basics}{9}{chapter.3}}
\newlabel{ch:solbase}{{\M@TitleReference {3}{Solving DSGE models - basics}}{9}{\relax }{chapter.3}{}}
\@writefile{toc}{\contentsline {section}{\numberline {3.1}A fundamental distinction}{9}{section.3.1}}
\newlabel{sec:distcn}{{\M@TitleReference {3.1}{A fundamental distinction}}{9}{A fundamental distinction\relax }{section.3.1}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.1.1}\textsf {NOTE!} Deterministic vs stochastic models}{10}{subsection.3.1.1}}
\newlabel{sec:detstoch}{{\M@TitleReference {3.1.1}{\textsf {NOTE!} Deterministic vs stochastic models}}{10}{\textsf {NOTE!} Deterministic vs stochastic models\relax }{subsection.3.1.1}{}}
\@writefile{toc}{\contentsline {section}{\numberline {3.2}Introducing an example}{11}{section.3.2}}
\newlabel{fig:modstruct}{{\M@TitleReference {3.3}{Dynare .mod file structure}}{15}{Dynare .mod file structure\relax }{section.3.3}{}}
\@writefile{lof}{\contentsline {figure}{\numberline {3.1}{\ignorespaces Structure of the .mod file}}{15}{figure.3.1}}
\@writefile{toc}{\contentsline {section}{\numberline {3.3}Dynare .mod file structure}{15}{section.3.3}}
\@writefile{toc}{\contentsline {section}{\numberline {3.4}Filling out the preamble}{15}{section.3.4}}
\newlabel{sec:preamble}{{\M@TitleReference {3.4}{Filling out the preamble}}{15}{Filling out the preamble\relax }{section.3.4}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.4.1}The deterministic case}{16}{subsection.3.4.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.4.2}The stochastic case}{16}{subsection.3.4.2}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.4.3}Comments on your first lines of Dynare code}{16}{subsection.3.4.3}}
\@writefile{toc}{\contentsline {section}{\numberline {3.5}Specifying the model}{17}{section.3.5}}
\newlabel{sec:modspe}{{\M@TitleReference {3.5}{Specifying the model}}{17}{Specifying the model\relax }{section.3.5}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.5.1}Model in Dynare notation}{17}{subsection.3.5.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.5.2}General conventions}{18}{subsection.3.5.2}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.5.3}Notational conventions}{19}{subsection.3.5.3}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.5.4}Timing conventions}{19}{subsection.3.5.4}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.5.5}Conventions specifying non-predetermined variables}{19}{subsection.3.5.5}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.5.6}Linear and log-linearized models}{20}{subsection.3.5.6}}
\@writefile{toc}{\contentsline {section}{\numberline {3.6}Specifying steady states and/or initial values}{20}{section.3.6}}
\newlabel{sec:ssshock}{{\M@TitleReference {3.6}{Specifying steady states and/or initial values}}{20}{Specifying steady states and/or initial values\relax }{section.3.6}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.6.1}Stochastic models and steady states}{21}{subsection.3.6.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.6.2}Deterministic models and initial values}{22}{subsection.3.6.2}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.6.3}Finding a steady state}{22}{subsection.3.6.3}}
\newlabel{sec:findsteady}{{\M@TitleReference {3.6.3}{Finding a steady state}}{22}{Finding a steady state\relax }{subsection.3.6.3}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.6.4}Checking system stability}{24}{subsection.3.6.4}}
\@writefile{toc}{\contentsline {section}{\numberline {3.7}Adding shocks}{24}{section.3.7}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.7.1}Deterministic models - temporary shocks}{24}{subsection.3.7.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.7.2}Deterministic models - permanent shocks}{25}{subsection.3.7.2}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.7.3}Stochastic models}{26}{subsection.3.7.3}}
\citation{Juillard1996}
\@writefile{toc}{\contentsline {section}{\numberline {3.8}Selecting a computation}{27}{section.3.8}}
\newlabel{sec:compute}{{\M@TitleReference {3.8}{Selecting a computation}}{27}{Selecting a computation\relax }{section.3.8}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.8.1}For deterministic models}{27}{subsection.3.8.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.8.2}For stochastic models}{27}{subsection.3.8.2}}
\citation{SchmittGrohe2004}
\citation{CollardJuillard2001a}
\@writefile{toc}{\contentsline {section}{\numberline {3.9}The complete .mod file}{30}{section.3.9}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.9.1}The stochastic model}{30}{subsection.3.9.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.9.2}The deterministic model (case of temporary shock)}{31}{subsection.3.9.2}}
\@writefile{toc}{\contentsline {section}{\numberline {3.10}File execution and results}{32}{section.3.10}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.10.1}Results - stochastic models}{32}{subsection.3.10.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.10.2}Results - deterministic models}{33}{subsection.3.10.2}}
\@setckpt{ch-solbase}{
\setcounter{page}{35}
\setcounter{equation}{0}
\setcounter{enumi}{7}
\setcounter{enumii}{0}
\setcounter{enumiii}{0}
\setcounter{enumiv}{0}
\setcounter{footnote}{1}
\setcounter{mpfootnote}{0}
\setcounter{storedpagenumber}{1}
\setcounter{part}{0}
\setcounter{chapter}{3}
\setcounter{section}{10}
\setcounter{subsection}{2}
\setcounter{subsubsection}{0}
\setcounter{paragraph}{0}
\setcounter{subparagraph}{0}
\setcounter{@ppsavesec}{0}
\setcounter{@ppsaveapp}{0}
\setcounter{vslineno}{0}
\setcounter{poemline}{0}
\setcounter{modulo@vs}{0}
\setcounter{verse}{0}
\setcounter{chrsinstr}{0}
\setcounter{poem}{0}
\setcounter{newflo@tctr}{4}
\setcounter{@contsubnum}{0}
\setcounter{maxsecnumdepth}{2}
\setcounter{sheetsequence}{43}
\setcounter{lastsheet}{96}
\setcounter{lastpage}{90}
\setcounter{bvlinectr}{0}
\setcounter{cp@cntr}{0}
\setcounter{ism@mctr}{0}
\setcounter{xsm@mctr}{0}
\setcounter{csm@mctr}{0}
\setcounter{ksm@mctr}{0}
\setcounter{xksm@mctr}{0}
\setcounter{cksm@mctr}{0}
\setcounter{msm@mctr}{0}
\setcounter{xmsm@mctr}{0}
\setcounter{cmsm@mctr}{0}
\setcounter{bsm@mctr}{0}
\setcounter{workm@mctr}{0}
\setcounter{figure}{1}
\setcounter{lofdepth}{1}
\setcounter{lofdepth}{1}
\setcounter{table}{0}
\setcounter{lotdepth}{1}
\setcounter{lotdepth}{1}
\setcounter{book}{0}
\setcounter{pagenote}{0}
\setcounter{lofdepth}{1}
\setcounter{lotdepth}{1}
\setcounter{parentequation}{0}
\setcounter{r@tfl@t}{0}
\setcounter{NAT@ctr}{0}
\setcounter{Item}{23}
\setcounter{memhycontfloat}{0}
\setcounter{definition}{0}
\setcounter{lemma}{0}
\setcounter{property}{0}
\setcounter{theorem}{0}
\setcounter{remark}{0}
\setcounter{section@level}{2}
}
\relax
\@writefile{lof}{\addvspace {10pt}}
\@writefile{lot}{\addvspace {10pt}}
\@writefile{toc}{\contentsline {chapter}{\chapternumberline {3}Solving DSGE models - basics}{9}{chapter.3}}
\newlabel{ch:solbase}{{3}{9}{\@empty \relax }{chapter.3}{}}
\@writefile{toc}{\contentsline {section}{\numberline {3.1}A fundamental distinction}{9}{section.3.1}}
\newlabel{sec:distcn}{{3.1}{9}{\@empty \relax }{section.3.1}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.1.1}\textsf {NOTE!} Deterministic vs stochastic models}{10}{subsection.3.1.1}}
\newlabel{sec:detstoch}{{3.1.1}{10}{\@empty \relax }{subsection.3.1.1}{}}
\@writefile{toc}{\contentsline {section}{\numberline {3.2}Introducing an example}{11}{section.3.2}}
\@writefile{toc}{\contentsline {section}{\numberline {3.3}Dynare .mod file structure}{15}{section.3.3}}
\@writefile{toc}{\contentsline {section}{\numberline {3.4}Filling out the preamble}{15}{section.3.4}}
\newlabel{sec:preamble}{{3.4}{15}{\@empty \relax }{section.3.4}{}}
\newlabel{fig:modstruct}{{3.3}{16}{\@empty \relax }{section.3.3}{}}
\@writefile{lof}{\contentsline {figure}{\numberline {3.1}{\ignorespaces Structure of the .mod file}}{16}{figure.3.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.4.1}The deterministic case}{16}{subsection.3.4.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.4.2}The stochastic case}{16}{subsection.3.4.2}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.4.3}Comments on your first lines of Dynare code}{17}{subsection.3.4.3}}
\@writefile{toc}{\contentsline {section}{\numberline {3.5}Specifying the model}{18}{section.3.5}}
\newlabel{sec:modspe}{{3.5}{18}{\@empty \relax }{section.3.5}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.5.1}Model in Dynare notation}{18}{subsection.3.5.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.5.2}General conventions}{19}{subsection.3.5.2}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.5.3}Notational conventions}{19}{subsection.3.5.3}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.5.4}Timing conventions}{19}{subsection.3.5.4}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.5.5}Conventions specifying non-predetermined variables}{20}{subsection.3.5.5}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.5.6}Linear and log-linearized models}{20}{subsection.3.5.6}}
\@writefile{toc}{\contentsline {section}{\numberline {3.6}Specifying steady states and/or initial values}{21}{section.3.6}}
\newlabel{sec:ssshock}{{3.6}{21}{\@empty \relax }{section.3.6}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.6.1}Stochastic models and steady states}{21}{subsection.3.6.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.6.2}Deterministic models and initial values}{23}{subsection.3.6.2}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.6.3}Finding a steady state}{23}{subsection.3.6.3}}
\newlabel{sec:findsteady}{{3.6.3}{23}{\@empty \relax }{subsection.3.6.3}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.6.4}Checking system stability}{24}{subsection.3.6.4}}
\@writefile{toc}{\contentsline {section}{\numberline {3.7}Adding shocks}{25}{section.3.7}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.7.1}Deterministic models - temporary shocks}{25}{subsection.3.7.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.7.2}Deterministic models - permanent shocks}{25}{subsection.3.7.2}}
\citation{Juillard1996}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.7.3}Stochastic models}{27}{subsection.3.7.3}}
\@writefile{toc}{\contentsline {section}{\numberline {3.8}Selecting a computation}{27}{section.3.8}}
\newlabel{sec:compute}{{3.8}{27}{\@empty \relax }{section.3.8}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.8.1}For deterministic models}{28}{subsection.3.8.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.8.2}For stochastic models}{28}{subsection.3.8.2}}
\citation{SchmittGrohe2004}
\citation{CollardJuillard2001a}
\@writefile{toc}{\contentsline {section}{\numberline {3.9}The complete .mod file}{31}{section.3.9}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.9.1}The stochastic model}{31}{subsection.3.9.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.9.2}The deterministic model (case of temporary shock)}{32}{subsection.3.9.2}}
\@writefile{toc}{\contentsline {section}{\numberline {3.10}File execution and results}{33}{section.3.10}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.10.1}Results - stochastic models}{33}{subsection.3.10.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.10.2}Results - deterministic models}{34}{subsection.3.10.2}}
\@setckpt{ch-solbase}{
\setcounter{page}{36}
\setcounter{equation}{0}
\setcounter{enumi}{7}
\setcounter{enumii}{0}
\setcounter{enumiii}{0}
\setcounter{enumiv}{0}
\setcounter{footnote}{1}
\setcounter{mpfootnote}{0}
\setcounter{storedpagenumber}{1}
\setcounter{part}{0}
\setcounter{chapter}{3}
\setcounter{section}{10}
\setcounter{subsection}{2}
\setcounter{subsubsection}{0}
\setcounter{paragraph}{0}
\setcounter{subparagraph}{0}
\setcounter{@ppsavesec}{0}
\setcounter{@ppsaveapp}{0}
\setcounter{vslineno}{0}
\setcounter{poemline}{0}
\setcounter{modulo@vs}{0}
\setcounter{verse}{0}
\setcounter{chrsinstr}{0}
\setcounter{newflo@tctr}{4}
\setcounter{@contsubnum}{0}
\setcounter{maxsecnumdepth}{2}
\setcounter{sheetsequence}{44}
\setcounter{lastsheet}{106}
\setcounter{lastpage}{98}
\setcounter{bvlinectr}{0}
\setcounter{cp@cntr}{0}
\setcounter{ism@mctr}{0}
\setcounter{xsm@mctr}{0}
\setcounter{csm@mctr}{0}
\setcounter{ksm@mctr}{0}
\setcounter{xksm@mctr}{0}
\setcounter{cksm@mctr}{0}
\setcounter{msm@mctr}{0}
\setcounter{xmsm@mctr}{0}
\setcounter{cmsm@mctr}{0}
\setcounter{bsm@mctr}{0}
\setcounter{workm@mctr}{0}
\setcounter{figure}{1}
\setcounter{lofdepth}{1}
\setcounter{lofdepth}{1}
\setcounter{table}{0}
\setcounter{lotdepth}{1}
\setcounter{lotdepth}{1}
\setcounter{parentequation}{0}
\setcounter{r@tfl@t}{0}
\setcounter{NAT@ctr}{0}
\setcounter{Item}{23}
\setcounter{definition}{0}
\setcounter{lemma}{0}
\setcounter{property}{0}
\setcounter{theorem}{0}
\setcounter{remark}{0}
\setcounter{lofdepth}{1}
\setcounter{lotdepth}{1}
\setcounter{section@level}{0}
}

View File

@ -323,7 +323,7 @@ Alternatively, you could also use an \textbf{external program to calculate exact
The alternative is to write a \textbf{Matlab} program to find your model's steady state. Doing so has the clear advantages of being able to incorporate your Matlab program directly into your .mod file so that running loops with different parameter values, for instance, becomes seamless. \textsf{\textbf{NOTE!}} When doing so, your matlab (.m) file should have the same name as your .mod file, followed by \texttt{\_steadystate} For instance, if your .mod file is called \texttt{example.mod}, your Matlab file should be called \texttt{example\_steadystate.m} and should be saved in the same directory as your .mod file. Dynare will automatically check the directory where you've saved your .mod file to see if such a Matlab file exists. If so, it will use that file to find steady state values regardless of whether you've provided initial values in your .mod file. \\
Because Matlab does not work with analytical expressions, though (unless you're working with a particular toolbox), you need to do a little work to write your steady state program. It is not enough to simply input the equations as you've written them in your .mod file and ask Matlab to solve the system. You will instead need to write your steady state program as if you were solving for the steady state by hand. That is, you need to input your expressions sequentially, whereby each left-hand side variable is written in terms of known parameters or variables already solved in the lines above. For example, the steady state file corresponding to the above example, in the stochastic case, would be: (** add example file) \\
Because Matlab does not work with analytical expressions, though (unless you're working with a particular toolbox), you need to do a little work to write your steady state program. It is not enough to simply input the equations as you've written them in your .mod file and ask Matlab to solve the system. You will instead need to write your steady state program as if you were solving for the steady state by hand. That is, you need to input your expressions sequentially, whereby each left-hand side variable is written in terms of known parameters or variables already solved in the lines above. For example, the steady state file corresponding to the above example, in the stochastic case, would be: (** example file to be added shortly) \\
\subsection{Checking system stability}
\textsf{\textbf{TIP!}} A handy command that you can add after the \texttt{initval} or \texttt{endval} block (following the \texttt{steady} command if you decide to add one) is the \texttt{check} command. This \textbf{computes and displays the eigenvalues of your system} which are used in the solution method. As mentioned earlier, a necessary condition for the uniqueness of a stable equilibrium in the neighborhood of the steady state is that there are
@ -377,9 +377,9 @@ endval;\\
end;\\
steady;}\\
\\
where \texttt{steady} can also be added to the \texttt{endval} block, and serves the same functionality as described earlier (namely, of telling Dynare to start and/ or end at a steady state close to the values you entered). In our example, we make use of the second \texttt{steady} since the actual terminal steady state values are bound to be somewhat different from those entered above, which are nothing but the initial values for all variables except for technology.\\
where \texttt{steady} can also be added to the \texttt{endval} block, and serves the same functionality as described earlier (namely, of telling Dynare to start and/ or end at a steady state close to the values you entered. If you do not use \texttt{steady} after \texttt{endval}, and the latter does not list exact steady state values, you may impose on your system that it does not return to steady state. This is unusual. In this case, your problem would become a so-called two boundary problem, which, when solved, requires that the path of your endogenous variables pass through the steady state closest to your \texttt{endval} values). In our example, we make use of the second \texttt{steady} since the actual terminal steady state values are bound to be somewhat different from those entered above, which are nothing but the initial values for all variables except for technology.\\
In the above example, the value of technology would move to 0.1 in period 1 (tomorrow) and thereafter. But of course, the other variables - the endogenous variables - will take longer to reach their new steady state values. \textsf{\textbf{TIP!}} If you instead wanted to study the effects of a permanent but future shock, you would have to add a \texttt{shocks} block after the \texttt{endval} block to ``undo'' the first several periods of the permanent shock. For instance, suppose you wanted the value of technology to move to 0.1, but only in period 10. Then you would follow the above \texttt{endval} block with:\\
In the above example, the value of technology would move to 0.1 in period 1 (tomorrow) and thereafter. But of course, the other variables - the endogenous variables - will take longer to reach their new steady state values. \textsf{\textbf{TIP!}} If you instead wanted to study the effects of a permanent but future shock (anticipated as usual), you would have to add a \texttt{shocks} block after the \texttt{endval} block to ``undo'' the first several periods of the permanent shock. For instance, suppose you wanted the value of technology to move to 0.1, but only in period 10. Then you would follow the above \texttt{endval} block with:\\
\\
\texttt{shocks;\\
var z;\\
@ -410,7 +410,7 @@ functions and various descriptive statistics (moments, variance decomposition, c
decomposition of the covariance matrix of the exogenous variables. When the shocks are correlated, the variance
decomposition depends upon the order of the variables in the varexo command.}\\
Impulse response functions are the expected future path of the endogenous variables conditional on a shock in period 1.\textsf{\textbf{TIP!}} If you linearize your model up to a first order, impulse response functions are simply the algebraic forward iteration of your model's policy or decision rule. If you instead linearize to a second order, impulse response functions will be the result of actual simulations of future shocks from the distribution you specified. But future shocks will not have a significant impact on your results, since they get averaged between each Monte Carlo trial and in the limit should sum to zero, given their mean of zero. In this case, Dynare will return the actual sample moments from the simulations. For first order linearizations, Dynare will instead report theoretical moments. In both cases, the return to steady state is asymptotic, \textsf{\textbf{TIP!}} thus you should make sure to specify sufficient periods in your IRFs such that you actually see your graphs return to steady state. Details on implementing this appear below.\\
Impulse response functions are the expected future path of the endogenous variables conditional on a shock in period 1 of one standard deviation.\textsf{\textbf{TIP!}} If you linearize your model up to a first order, impulse response functions are simply the algebraic forward iteration of your model's policy or decision rule. If you instead linearize to a second order, impulse response functions will be the result of actual Monte Carlo simulations of future shocks. This is because in second order linear equations, you will have cross terms involving the shocks, so that the effects of the shocks depend on the state of the system when the shocks hit. Thus, it is impossible to get algebraic average values of all future shocks and their impact. The technique is instead to pull future shocks from their distribution and see how they impact your system, and repeat this procedure a multitude of times in order to draw out an average response. That said, note that future shocks will not have a significant impact on your results, since they get averaged between each Monte Carlo trial and in the limit should sum to zero, given their mean of zero. Note that in the case of a second order approximation, Dynare will return the actual sample moments from the simulations. For first order linearizations, Dynare will instead report theoretical moments. In both cases, the return to steady state is asymptotic, \textsf{\textbf{TIP!}} thus you should make sure to specify sufficient periods in your IRFs such that you actually see your graphs return to steady state. Details on implementing this appear below.\\
If you're interested to peer a little further into what exactly is going on behind the scenes of Dynare's computations, have a look at Chapter \ref{ch:solbeh}. Here instead, we focus on the application of the command and reproduce below the most common options that can be added to \texttt{stoch\_simul}. For a complete list of options, please see the \href{http://www.cepremap.cnrs.fr/juillard/mambo/index.php?option=com_content&task=view&id=51&Itemid=84}{Reference Manual}. \\
@ -431,14 +431,14 @@ plotting of IRF
\item nomoments: doesnÕt print moments of the endogenous variables (printing them is the default).
\item noprint: cancel any printing; usefull for loops.
\item order = 1 or 2 : order of Taylor approximation (default = 2), unless you're working with a linear model in which case the order is automatically set to 1.
\item periods = INTEGER: specifies the number of periods to use in simulations (default = 0).
\item periods = INTEGER: specifies the number of periods to use in simulations (default = 0). \textsf{\textbf{TIP!}} A simulation is similar to running impulse response functions with a model linearized to the second order, in the way that both sample shocks from their distribution to see how the system reacts, but a simulation only repeats the process once, whereas impulse response functions run a multitude of Monte Carlo trials in order to get an average response of your system.
\item qz\_criterium = INTEGER or DOUBLE: value used to split stable from unstable eigenvalues in reordering the
Generalized Schur decomposition used for solving 1st order problems (default = 1.000001).
\item replic = INTEGER: number of simulated series used to compute the IRFs (default = 1 if order = 1, and 50
otherwise).
\item simul\_seed = INTEGER or DOUBLE or (EXPRESSION): specifies a seed for the random number generator so as to obtain the
same random sample at each run of the program. Otherwise a different sample is used for each run (default: seed
not specified). If you use the option \texttt{period} after \texttt{stoch\_simul}, and have linearized your model to the second order, Dynare will actually undertake Monte Carlo simulations to generate moments of your variables. Because of the simulation, results are bound to be slightly different each time you run your program, except if you fix the seed for the random number generator. \textsf{\textbf{TIP!}} If you do decide to fix the seed, you should at least try to run your program without using \texttt{simul\_seed}, just to check the robustness of your results.
not specified). If you linearized to a second order, Dynare will actually undertake Monte Carlo simulations to generate moments of your variables. Because of the simulation, results are bound to be slightly different each time you run your program, except if you fix the seed for the random number generator. \textsf{\textbf{TIP!}} If you do decide to fix the seed, you should at least try to run your program without using \texttt{simul\_seed}, just to check the robustness of your results.
\end{itemize}
Going back to our good old example, suppose we were interested in printing all the various measures of moments of our variables, want to see impulse response functions for all variables, are basically happy with all default options and want to carry out simulations over a good number of periods. We would then end our .mod file with the following command:\\
@ -446,7 +446,7 @@ Going back to our good old example, suppose we were interested in printing all t
\texttt{stoch\_simul(periods=2100);}\\
\section{The complete .mod file}
For completion's sake, and for the pleasure of seeing our work bear its fruits, here are the complete .mod files corresponding to our example for the deterministic and stochastic case. These can be found in the example folder of your Dynare installation under: \texttt{RBC\_Monop\_JFV.mod} for stochastic models and \texttt{RBC\_Monop\_Det.mod} for deterministic models.
For completion's sake, and for the pleasure of seeing our work bear its fruits, here are the complete .mod files corresponding to our example for the deterministic and stochastic case. You can find the corresponding files in the \textsl{models} folder under \textsl{UserGuide} in your installation of Dynare. The files are called \texttt{RBC\_Monop\_JFV.mod} for stochastic models and \texttt{RBC\_Monop\_Det.mod} for deterministic models.
\subsection{The stochastic model}

View File

@ -8,27 +8,33 @@ psi*c/(1-l) = w;
c+i = y;
y = (k(-1)^alpha)*(exp(z)*l)^(1-alpha);
w = y*((epsilon-1)/epsilon)*(1-alpha)/l;
r = y*((epsilon-1)/epsilon)*alpha/k;
r = y*((epsilon-1)/epsilon)*alpha/k(-1);
i = k-(1-delta)*k(-1);
y_l = y/l;
z = rho*z(-1)+e;
end;
end;
varobs y;
initval;
k = 9;
c = 0.76;
l = 0.3;
w = 2.07;
r = 0.03;
z = 0;
e = 0;
end;
estimated_params;
alpha, beta_pdf, 0.35, 0.02;
beta, beta_pdf, 0.99, 0.002;
delta, beta_pdf, 0.025, 0.003;
psi, beta_pdf, 1.75, 0.02;
psi, gamma_pdf, 1.75, 0.02;
rho, beta_pdf, 0.95, 0.05;
epsilon, beta_pdf, 10, 0.003;
epsilon, gamma_pdf, 10, 0.003;
stderr e, inv_gamma_pdf, 0.01, inf;
end;
estimation(datafile=simuldataRBC,nobs=200,first_obs=500,mh_replic=2000,mh_nblocks=2,mh_drop=0.45,mh_jscale=0.8);

View File

@ -1,11 +1,10 @@
var y c k i l y_l w r ;
varexo z;
parameters beta psi delta alpha rho sigma epsilon;
parameters beta psi delta alpha sigma epsilon;
alpha = 0.33;
beta = 0.99;
delta = 0.023;
psi = 1.75;
rho = 0.95;
psi = 1.75;
sigma = (0.007/(1-alpha));
epsilon = 10;
@ -15,7 +14,7 @@ model;
c+i = y;
y = (k(-1)^alpha)*(exp(z)*l)^(1-alpha);
w = y*((epsilon-1)/epsilon)*(1-alpha)/l;
r = y*((epsilon-1)/epsilon)*alpha/k;
r = y*((epsilon-1)/epsilon)*alpha/k(-1);
i = k-(1-delta)*k(-1);
y_l = y/l;
end;

View File

@ -1,43 +1,6 @@
% Basic RBC Model with Monopolistic Competion.
// Adapted from Jesus Fernandez-Villaverde, Basic RBC Model with Monopolistic Competion Philadelphia, March 3, 2005
%
% Jesus Fernandez-Villaverde
% Philadelphia, March 3, 2005
%----------------------------------------------------------------
% 0. Housekeeping
%----------------------------------------------------------------
close all
%----------------------------------------------------------------
% 1. Defining variables
%----------------------------------------------------------------
@ -56,20 +19,6 @@ parameters beta psi delta alpha rho gamma sigma epsilon;
%----------------------------------------------------------------
% 2. Calibration
%----------------------------------------------------------------
alpha = 0.33;
@ -94,18 +43,6 @@ epsilon = 10;
%----------------------------------------------------------------
% 3. Model
%----------------------------------------------------------------
model;
@ -124,7 +61,7 @@ model;
w = y*((epsilon-1)/epsilon)*(1-alpha)/l;
r = y*((epsilon-1)/epsilon)*alpha/k;
r = y*((epsilon-1)/epsilon)*alpha/k(-1);
i = k-(1-delta)*k(-1);
@ -140,20 +77,6 @@ end;
%----------------------------------------------------------------
% 4. Computation
%----------------------------------------------------------------
initval;
@ -179,7 +102,10 @@ initval;
end;
steady;
check;
@ -202,30 +128,6 @@ steady;
stoch_simul(dr_algo=0, hp_filter = 1600, order = 1);
%----------------------------------------------------------------
% 5. Some Results
%----------------------------------------------------------------
statistic1 = 100*sqrt(diag(oo_.var(1:8,1:8)))./oo_.mean(1:8);
table('Relative standard deviations in %',strvcat('VARIABLE','REL. S.D.'),lgy_(1:8,:),statistic1,10,8,4)
stoch_simul(periods=2100);