IDEAS home Printed from

Matlab Code for Solving Linear Rational Expectations Models


  • Christopher Sims

    (Princeton University)

Programming Language



A computationally robust solution method for linear rational expectations models is displayed, based on the QZ matrix decomposition. Any rational expectations model, in continuous or discrete time, can be solved by this approach. It requires that the model be cast into first-order form, but it does not require that it be reduced so that the number of states matches the number of equations. It also avoids the artificial requirement that variables be designated as "jump" variables or not. (Instead, how expectational error terms enter the system must be specified - a more general specification.) The code automatically determines whether the model satisfies conditions for existence and uniqueness. Two matlab files, gensys.m and gensysct.m, analyze linear rational expectations systems and return solutions for their dependence on exogenous disturbances. The systems need not have non-singular lead matrices (coefficients on current variables in discrete time, on derivatives in continuous time) and they need not be well-specified. The program analyzes them to determine whether solutions exist and whether they are unique. It returns a solution even when it is not unique, and it returns a solution that constrains exogenous variable behavior when no solution that does not do so exists. The continuous time program, unlike the discrete time program, handles only the case of serially uncorrelated exogenous processes. The files qzdiv.m, qzdivct.m, and qzswitch.m are required by the gensys.m programs. If you try to implement the algorithm in non-Matlab languages, you will need to find or write a routine that does the complex QZ (or generalized Schur) decomposition. Fortran routines that do this are available in the ACM algorithm files.

Suggested Citation

  • Christopher Sims, 2001. "Matlab Code for Solving Linear Rational Expectations Models," QM&RBC Codes 11, Quantitative Macroeconomics & Real Business Cycles.
  • Handle: RePEc:dge:qmrbcd:11

    Download full text from publisher

    File URL:
    File Function: program code
    Download Restriction: none

    Other versions of this item:

    More about this item




    Access and download statistics


    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:dge:qmrbcd:11. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    We have no bibliographic references for this item. You can help adding them by using this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: Christian Zimmermann (email available below). General contact details of provider: .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.