% This LaTeX was auto-generated from an M-file by MATLAB.
% To make changes, update the M-file and republish this document.
\documentclass{article}
\usepackage{graphicx}
\usepackage{color}
\sloppy
\definecolor{lightgray}{gray}{0.5}
\setlength{\parindent}{0pt}
\begin{document}
\section*{Dunare AIM Solver Subsystem}
\subsection*{Contents}
\begin{itemize}
\setlength{\itemsep}{-1ex}
\item AIM Solver Subsystem
\item APPENDIX 1: AIM System SPecification and Dynare Mapping
\item APPENDIX 2: dynAIMsolver1 Function Specification
\end{itemize}
\subsection*{AIM Solver Subsystem}
\begin{par}
The AIM subsystem in the AIM subdirectory of the main Dynare matlab directory contains Matlab functions necessary for using Gary Anderson's AIM 1st order solver as an alternative to Dynare's default mjdgges solver (see \begin{verbatim}http://www.federalreserve.gov/Pubs/oss/oss4/aimindex.html\end{verbatim} ).
\end{par}\vspace{1em}
\begin{par}
It cosists of:
\end{par}\vspace{1em}
\begin{itemize}
\setlength{\itemsep}{-1ex}
\item New Dynare function \textbf{dynAIMsolver1(jacobia\_, M\_, dr)} which is called from \textbf{dr1.m} and which maps Dynare system to the AIM package subsystem. It then derives the solution for gy=dr.hgx and gu=dr.hgu from the AIM outputs. ("1" in the title is for 1st order solver).
\end{itemize}
\begin{itemize}
\setlength{\itemsep}{-1ex}
\item A subset of Matlab routines from Gary Anderson's own AIM package needed to compute and solve system passed on and returned by dynAIMsolver1 whose names start with SP.. of which \textbf{SPAmalg.m} is the main driver:
\end{itemize}
\begin{itemize}
\setlength{\itemsep}{-1ex}
\item SPAmalg.m
\item SPBuild\_a.m
\item SPSparse.m
\item SPShiftright.m
\item SPExact\_shift.m
\item SPNumeric\_shift.m
\item SPObstruct.m
\item SPEigensystem.m
\item SPReduced\_form
\item SPCopy\_w.m
\item SPAimerr.m
\end{itemize}
\begin{par}
The path to the AIM directory, if exists, is added by \textbf{dynare\_config.m} using addpath
\end{par}\vspace{1em}
\begin{par}
\textbf{USE:}
\end{par}\vspace{1em}
\begin{par}
Dynare DR1.m tries to invoke AIM solver instead default mjdgges if options\_.useAIM == 1 is set and, if not check only, and if 1st order solution is needed, i.e.:
For a start, options\_.useAIM = 0 is set by default in \textbf{global\_initialization.m} so that system uses mjdgges by default.
\end{par}\vspace{1em}
\begin{par}
If AIM is to be used, options\_.useAIM = 1 needs to be set either in the model \begin{verbatim}modelname\end{verbatim}.mod file, before invoking, estimate and/or stoch\_simul, or by issuing appropriate command for estimate and/or stoch\_simul.
\end{par}\vspace{1em}
\begin{par}
\textbf{RELEASE NOTES:}
\end{par}\vspace{1em}
\begin{par}
In the current implementation, as of July 2008, only first order solution is supported and handling of exceptions is rather fundamental and, in particular, when Blanchard and Kahn conditions are not met, only a large penalty value 1.0e+8 is being set.
\end{par}\vspace{1em}
\begin{par}
Hence, system may not coverge or the resluts may not be accurate if there were many messages like
\end{par}\vspace{1em}
\begin{itemize}
\setlength{\itemsep}{-1ex}
\item "Error in AIM: aimcode=4 : Aim: too few big roots", or
\item "Error in AIM: aimcode=3 : Aim: too many big roots"
\end{itemize}
\begin{par}
especially when issued close to the point of convergence.
\end{par}\vspace{1em}
\begin{par}
However, if other exceptions occur and aimcode (see codes below) is higher than 5, the system resets options\_.useAIM = 0 and tries to use mjdgges instead.
\end{par}\vspace{1em}
\subsection*{APPENDIX 1: AIM System SPecification and Dynare Mapping}
\begin{par}
AIM System for thau lags and theta leads, and:
\end{par}\vspace{1em}
\begin{par}
$$i=-\tau...+\theta$$
\end{par}\vspace{1em}
\begin{par}
$$\sum_{i=-\tau}^\theta(H_i*x_{t+i})=\Psi*z_t$$
\end{par}\vspace{1em}
\begin{par}
where xt+i is system vectors at time t for all lag/lead t+i and zt is vector of exogenous shocks.
and AIM output in the form of endogenous transition matrix \textbf{bb}:
\end{par}\vspace{1em}
\begin{par}
$$bb=[B_{-\tau}... B_i \ ...\ B_{-1}]$$
\end{par}\vspace{1em}
\begin{par}
and, for simple case of one lag system, the matrix Phi derived as:
\end{par}\vspace{1em}
\begin{par}
$$\phi=(H_O+H_1*B_{-1})^{-1}$$
\end{par}\vspace{1em}
\begin{par}
For more lags, the phi equation becomes more complicated (see documentation on G.Anderson's site above).
\end{par}\vspace{1em}
\begin{par}
\textbf{Dynare AIM Mapping - input}
\end{par}\vspace{1em}
\begin{par}
For Dynare jacobian = [fy'-tau... fy'i ... fy'+theta fu'] - where -tau and +theta are subscripts, we have that its subset without exogenous term fu' and expanded with zero columns represents \textbf{H}, i.e.: