Skip to content

julia implementation of the anderson moore algorithm for solving linear rational expectations models

License

Notifications You must be signed in to change notification settings

gtunell/AMA.jl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AMA - Anderson Moore Algorithm

Release verison:

Build status:

Build Status Build status Coverage Status codecov.io

Installion

To install AMA, use the package manager by typing:

Pkg.add("AMA")

Usage

This algorithm solves linear rational expectations models. There is a fast and slightly faster use for this package outlined below. The former calls a julia language implementation and the latter calls a C/Fortran implementation. To begin,

Load the module:

using AMA

Declare the linear models to solve such as:

h = [0.  0.  0.  0.  -1.1  0.  0.  0.  1.  1.  0.  0.;
     0.  -0.4  0.  0.  0.  1.  -1.  0.  0.  0.  0.  0.;
     0.  0.  0.  0.  0.  0.  1.  0.  0.  0.  0.  0.;
     0.  0.  0.  -1.  0.  0.  0.  1.  0.  0.  0.  0.]::Array{Float64,2}

Set number of equations:

neq = 4

Set number of lags and leads:

nlags = 1
nleads = 1

Set a tolerance to calculate numeric shift and reduced form:

condn = 0.0000000001

Finally, give an inclusive upper bound for modulus of roots allowed in reduced form:

upperbnd = 1 + condn

To execute the algorithm with julia:

(b, rts, ia, nexact, nnumeric, lgroots, AMAcode) =
     AMAalg(h, neq, nlag, nlead, condn, upperbnd)

Note - the above returns the tuple (b, rts, ia, nexact, nnumeric, lgroots, AMAcode)

  • b - Reduced form coefficient matrix.
  • rts - Roots returned by eig.
  • ia - Dimension of companion matrix.
  • nexact - Number of exact shift rights.
  • nnumeric - Number of numeric shift rights.
  • lgroots - Number of roots greater in modulus than upper bound.
  • AMAcode - Return code.

To execute the algorithm with C/Fortran:

(h, b, q, AMAcode) = 
     callSparseAim(h, nleads, nlags)

Note - the above returns the tuple (h, b, q, AMAcode)

  • h - The original h matrix after computations.
  • b - Reduced form coefficient matrix.
  • q - Asymptotic constraints.
  • AMAcode - Return code.

More

For more information and an indepth analysis of the algorithm, please read the full paper written by Gary S. Anderson.

Author: Gregory Tunell available at gregtunell@gmail.com.

About

julia implementation of the anderson moore algorithm for solving linear rational expectations models

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Julia 97.3%
  • MATLAB 2.7%