### User guide: fix non stationary example (use diffuse_filter option instead of unit_root_vars)

parent 19a994af
 ... ... @@ -194,13 +194,6 @@ end;}\\ In general, the command \texttt{observation\_trends} specifies linear trends as a function of model parameters for the observed variables in the model.\\ \subsection{Declaring unit roots in observable variables} 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;}\\ \\ \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. 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. ... ... @@ -225,7 +218,10 @@ end;}\\ 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=2000,\\ mode\_compute=4,mh\_nblocks=2,mh\_drop=0.45,mh\_jscale=0.65);}\\ mode\_compute=4,mh\_nblocks=2,mh\_drop=0.45,mh\_jscale=0.65,\\ diffuse\_filter);}\\ \textsf{\textbf{NOTE!}} 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 use the \texttt{diffuse\_filter} option. Also note that you don't need to use the diffuse filter for any non-stationary model, only for when there is a unit-root, \textit{i.e.} a stochastic trend; you don't need to use a diffuse initial condition in the case of a deterministic trend, since the variance is finite.\\ \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.\\ ... ... @@ -262,8 +258,6 @@ P\_obs (log(mst)-gam);\\ Y\_obs (gam);\\ end;\\ \\ unit\_root\_vars P\_obs Y\_obs;\\ \\ initval;\\ k = 6;\\ m = mst;\\ ... ... @@ -283,8 +277,6 @@ end;\\ // of your model, since the estimation will use the Matlab\\ // steady state file also provided and discussed above.\\ \\ steady;\\ \\ estimated\_params;\\ alp, beta\_pdf, 0.356, 0.02; \\ bet, beta\_pdf, 0.993, 0.002; \\ ... ... @@ -298,7 +290,8 @@ stderr e\_m, inv\_gamma\_pdf, 0.008862, inf;\\ end;\\ \\ estimation(datafile=fsdat,nobs=192,loglinear,mh\_replic=2000,\\ mode\_compute=4,mh\_nblocks=2,mh\_drop=0.45,mh\_jscale=0.65);}\\ mode\_compute=4,mh\_nblocks=2,mh\_drop=0.45,mh\_jscale=0.65,\\ diffuse\_filter);}\\ \\ \subsection{Summing it up} ... ...
 ... ... @@ -46,8 +46,6 @@ P_obs (log(mst)-gam); Y_obs (gam); end; unit_root_vars P_obs Y_obs; initval; k = 6; m = mst; ... ... @@ -67,8 +65,6 @@ end; // of your model, since the estimation will use the Matlab // steady state file also provided and discussed above. steady; estimated_params; alp, beta_pdf, 0.356, 0.02; bet, beta_pdf, 0.993, 0.002; ... ... @@ -82,4 +78,4 @@ stderr e_m, inv_gamma_pdf, 0.008862, inf; end; estimation(datafile=fsdat,nobs=192,loglinear,mh_replic=2000, mode_compute=4,mh_nblocks=2,mh_drop=0.45,mh_jscale=0.65); \ No newline at end of file mode_compute=4,mh_nblocks=2,mh_drop=0.45,mh_jscale=0.65,diffuse_filter); \ No newline at end of file
 % computes the steady state of fs2000 analyticaly % largely inspired by the program of F. Schorfheide function [ys,check] = fs2000a_steadystate(ys,exe) function [ys,check] = fs2000ns_steadystate(ys,exe) global M_ alp = M_.params(1); ... ...
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!