diff --git a/README.md b/README.md index 72d1292a3fd01f27e787f978f0fb78eb8925bfba..4248c0ad72420e44154c26c256dd5a4d4c67b6e8 100644 --- a/README.md +++ b/README.md @@ -274,7 +274,7 @@ Configure and make: - ```brew install texi2html``` - **(On OS X 10.7 Only)** Copy [FlexLexer.h](http://www.dynare.org/DynareWiki/BuildingDynareFromSource?action=AttachFile&do=view&target=FlexLexer.h) into the `preprocessor` directory (there was an error in the `FlexLexer.h` file distributed with 10.7) - Finally, switch to the root dynare directory. Ensure your path contains `/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/texbin:/usr/local/sbin`. Run: - - `autoconf -si` + - `autoreconf -si` - `./configure --with-matlab=/Applications/MATLAB_R2013a.app MATLAB_VERSION=8.1 YACC=/usr/local/Cellar/bison/<<BISON VERSION>>/bin/bison` - `make` - `make pdf TEXI2DVI=/usr/local/Cellar/texinfo/5.2/bin/texi2dvi`, where you replace everything after the equal sign with the path to the `texi2dvi` installed by homebrew when you installed `texinfo`. diff --git a/doc/dseries-and-reporting/dseriesReporting.tex b/doc/dseries-and-reporting/dseriesReporting.tex index 24b2ef8b264bcc25373d699cdbb4b4c704eeb67a..ff8955426c50375587cb368755a5ff79a8aa0ac5 100644 --- a/doc/dseries-and-reporting/dseriesReporting.tex +++ b/doc/dseries-and-reporting/dseriesReporting.tex @@ -77,9 +77,9 @@ \subsection{A Programming Note} \begin{frame}[fragile,t] - \frametitle{A Programming Note (1/2)} + \frametitle{A Programming Note (1/3)} \begin{itemize} - \myitem Time series and dates are implemented as Matlab/Octave classes + \myitem Time series and dates (and reporting) are implemented as Matlab/Octave classes \myitem Inplace modification of instantiated objects not supported. Let me explain \dots \begin{itemize} \myitem A class is a template for defining objects, defining their member @@ -111,7 +111,7 @@ X = \begin{frame}[fragile,t] - \frametitle{A Programming Note (2)} + \frametitle{A Programming Note (2/3)} \begin{itemize} \item[] \begin{itemize} \myitem But! For Matlab/Octave's implementation of classes this is not the @@ -134,7 +134,7 @@ X = \end{frame} \begin{frame}[fragile,t] - \frametitle{A Programming Note (concluded)} + \frametitle{A Programming Note (3/3)} \begin{itemize} \item[] \begin{itemize} \myitem To get the desired change, you must overwrite \texttt{X} @@ -170,7 +170,7 @@ X = \myitem The \texttt{dates} command creates an object that represents at least one date at a given frequency \myitem A \texttt{dates} object contains 3 members (fields): \begin{itemize} - \myitem{\textbf{\texttt{freq}}}: 1 (Annual), 4 (Quarterly), 12 (Monthly), 52 (Weekly) + \myitem{\textbf{\texttt{freq}}}: 1, `y' (Annual); 4, `q' (Quarterly); 12, `m' (Monthly); 52, `w' (Weekly) \myitem{\textbf{\texttt{ndat}}}: The number of dates \myitem{\textbf{\texttt{time}}}: An \texttt{ndat$\times$2} matrix; the 1\textsuperscript{st} col is the year and the 2\textsuperscript{nd} col is the period \end{itemize} @@ -681,13 +681,13 @@ the time range of \verb+vs+ will be the union of \verb+ts.dates+ and text centered, anchor=north, text=black, text width=2.6cm] \tikzstyle{comment}=[rectangle, draw=black, rounded corners, fill=green!10, drop shadow, text centered, anchor=north, text=black, text width=2.6cm] - +\tikzstyle{line}=[-, thick] \begin{frame}[fragile,t] \frametitle{Reporting Class Hierarchy} \begin{itemize} \myitem Class names on the top half of the box, constructor names on the bottom - \myitem Arrows represent what the new object can be added to; objects in ellipses are treated a bit differently (explained below) + \myitem Arrows represent what the new object can be added to; objects in green are treated a bit differently (explained below) \end{itemize} \begin{center} \footnotesize{ @@ -743,8 +743,8 @@ the time range of \verb+vs+ will be the union of \verb+ts.dates+ and \draw [line] (Series) to node { } (Graph); \draw [line] (Table) to node { } (Section); \draw [line] (Graph) to node { } (Section); - \draw [line] (Paragraph.north) to node { } (Section); - \draw [line] (Vspace.north) to node { } (Section); + \draw [line] (Paragraph.north) to node { } (Section.east); + \draw [line] (Vspace.north) to node { } (Section.west); \draw [line] (Section) to node { } (Page); \draw [line] (Page) to node { } (Report); \end{tikzpicture}} diff --git a/matlab/ep/ep_problem_2.m b/matlab/ep/ep_problem_2.m index f10ccc942f892ee8ffb885a0b3e2b7488ee43152..51091693361c851c304cc4abcf5a7ea3837bfe34 100644 --- a/matlab/ep/ep_problem_2.m +++ b/matlab/ep/ep_problem_2.m @@ -101,9 +101,6 @@ for i = 1:order+1 else d1 = dynamic_model(z,innovation,params,steady_state,i+1); end - if any(isnan(d1)) - pause - end res(:,i,1) = res(:,i,1)+weights(k)*d1(eq_index); end if nargout > 1 @@ -130,9 +127,6 @@ for i = 1:order+1 else d1 = dynamic_model(z,innovation,params,steady_state,i+1); end - if any(isnan(d1)) - pause - end res(:,i,j) = d1(eq_index); if nargout > 1 i_cols_Af = i_cols_Af + ny; @@ -155,9 +149,6 @@ for i = 1:order+1 else d1 = dynamic_model(z,innovation,params,steady_state,i+1); end - if any(isnan(d1)) - pause - end res(:,i,j) = d1(eq_index); end i_rows = i_rows + ny; @@ -191,9 +182,6 @@ for j=1:world_nbr d1 = dynamic_model(Y(i_rows_y,j),x,params, ... steady_state,i+1); end - if any(isnan(d1)) - pause - end res(:,i,j) = d1(eq_index); i_rows_y = i_rows_y + ny; offset_c = offset_c + world_nbr*ny; diff --git a/matlab/ep/extended_path.m b/matlab/ep/extended_path.m index bc1b5020c9eeb59bb23f40f82a256234a2e89db2..4867c39124dbe22fc6f4ed627dea1d3cdddb4f29 100644 --- a/matlab/ep/extended_path.m +++ b/matlab/ep/extended_path.m @@ -121,8 +121,6 @@ switch options_.ep.innovation_distribution error(['extended_path:: ' options_.ep.innovation_distribution ' distribution for the structural innovations is not (yet) implemented!']) end -% Initializes some variables. -t = 0; % Set waitbar (graphic or text mode) hh = dyn_waitbar(0,'Please wait. Extended Path simulations...'); @@ -146,18 +144,30 @@ pfm.nnzA = M_.NNZDerivatives(1); if options_.ep.stochastic.order > 0 [nodes,weights,nnodes] = setup_integration_nodes(options_.ep,pfm); pfm.nodes = nodes; - pfm.weights = weights; + pfm.weights = weights; pfm.nnodes = nnodes; + + % compute number of blocks + [block_nbr,pfm.world_nbr] = get_block_world_nbr(options_.ep.stochastic.algo,nnodes,options_.ep.ut.k,options_.ep.periods); +else + block_nbr = options_.ep.periods end -% compute number of blocks -[block_nbr,pfm.world_nbr] = get_block_world_nbr(options_.ep.stochastic.algo,nnodes,options_.ep.ut.k,options_.ep.periods); + % set boundaries if mcp [lb,ub,pfm.eq_index] = get_complementarity_conditions(M_); options_.lmmcp.lb = repmat(lb,block_nbr,1); options_.lmmcp.ub = repmat(ub,block_nbr,1); pfm.block_nbr = block_nbr; +% storage for failed draws +oo_.ep.failures.periods = []; +oo_.ep.failures.previous_period = cell(0); +oo_.ep.failures.shocks = cell(0); + +% Initializes some variables. +t = 0; +tsimul = 1; % Main loop. while (t<sample_size) if ~mod(t,10) @@ -337,7 +347,8 @@ while (t<sample_size) end% if info_convergence end end% while - if ~info_convergence% If exited from the while loop without achieving convergence, use an homotopic approach + if ~info_convergence && ep.homotopic_steps % If exited from the while loop without achieving + % convergence use an homotopic approach if ~do_not_check_stability_flag periods1 = ep.periods; pfm1.periods = periods1; @@ -375,11 +386,18 @@ while (t<sample_size) end end end - % Save results of the perfect foresight model solver. - time_series(:,t) = endo_simul_1(:,2); - endo_simul_1(:,1:end-1) = endo_simul_1(:,2:end); - endo_simul_1(:,1) = time_series(:,t); - endo_simul_1(:,end) = oo_.steady_state; + if info_convergence + % Save results of the perfect foresight model solver. + time_series(:,tsimul) = endo_simul_1(:,2); + endo_simul_1(:,1:end-1) = endo_simul_1(:,2:end); + endo_simul_1(:,1) = time_series(:,tsimul); + endo_simul_1(:,end) = oo_.steady_state; + tsimul = tsimul+1; + else + oo_.ep.failures.periods = [oo_.ep.failures.periods t]; + oo_.ep.failures.previous_period = [oo_.ep.failures.previous_period endo_simul_1(:,1)]; + oo_.ep.failures.shocks = [oo_.ep.failures.shocks shocks]; + end end% (while) loop over t dyn_waitbar_close(hh); diff --git a/matlab/global_initialization.m b/matlab/global_initialization.m index 1122b99bb9796c425eb99462ae9462d936f2645a..e9ee6c88d7777919597593f79596ff802391f57e 100644 --- a/matlab/global_initialization.m +++ b/matlab/global_initialization.m @@ -197,6 +197,8 @@ ep.stochastic.quadrature.pruned.status = 0; ep.stochastic.quadrature.pruned.relative = 1e-5; ep.stochastic.quadrature.pruned.level = 1e-5; ep.stochastic.hybrid_order = 0; +% homotopic step in extended path simulations +ep.stochastic.homotopic_steps = true; % Copy ep structure in options_ global structure options_.ep = ep;