v4.1 matlab/AIM: added license notice
git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@2036 ac1d8469-bf42-47a9-8791-bf33cf982152time-shift
parent
80c86e23ed
commit
544dbe9ecb
|
@ -2,9 +2,32 @@ function e = SPAimerr(c);
|
|||
% e = aimerr(c);
|
||||
%
|
||||
% Interpret the return codes generated by the aim routines.
|
||||
|
||||
%
|
||||
% The return code c = 2 is used by aim_schur.m but not by aim_eig.m.
|
||||
|
||||
% Original author: Gary Anderson
|
||||
% Original file downloaded from:
|
||||
% http://www.federalreserve.gov/Pubs/oss/oss4/code.html
|
||||
% Adapted for Dynare by Dynare Team.
|
||||
%
|
||||
% This code is in the public domain and may be used freely.
|
||||
% However the authors would appreciate acknowledgement of the source by
|
||||
% citation of any of the following papers:
|
||||
%
|
||||
% Anderson, G. and Moore, G.
|
||||
% "A Linear Algebraic Procedure for Solving Linear Perfect Foresight
|
||||
% Models."
|
||||
% Economics Letters, 17, 1985.
|
||||
%
|
||||
% Anderson, G.
|
||||
% "Solving Linear Rational Expectations Models: A Horse Race"
|
||||
% Computational Economics, 2008, vol. 31, issue 2, pages 95-113
|
||||
%
|
||||
% Anderson, G.
|
||||
% "A Reliable and Computationally Efficient Algorithm for Imposing the
|
||||
% Saddle Point Property in Dynamic Models"
|
||||
% Journal of Economic Dynamics and Control, Forthcoming
|
||||
|
||||
if(c==1) e='Aim: unique solution.';
|
||||
elseif(c==2) e='Aim: roots not correctly computed by real_schur.';
|
||||
elseif(c==3) e='Aim: too many big roots.';
|
||||
|
|
|
@ -28,8 +28,31 @@
|
|||
% nnumeric Number of numeric shiftrights.
|
||||
% lgroots Number of roots greater in modulus than uprbnd.
|
||||
% aimcode Return code: see function aimerr.
|
||||
% Modified to deal with infinite or nan A Dec 12 2007
|
||||
% =========================================================
|
||||
|
||||
% Original author: Gary Anderson
|
||||
% Original file downloaded from:
|
||||
% http://www.federalreserve.gov/Pubs/oss/oss4/code.html
|
||||
% Adapted for Dynare by Dynare Team, in order to deal
|
||||
% with infinite or nan values.
|
||||
%
|
||||
% This code is in the public domain and may be used freely.
|
||||
% However the authors would appreciate acknowledgement of the source by
|
||||
% citation of any of the following papers:
|
||||
%
|
||||
% Anderson, G. and Moore, G.
|
||||
% "A Linear Algebraic Procedure for Solving Linear Perfect Foresight
|
||||
% Models."
|
||||
% Economics Letters, 17, 1985.
|
||||
%
|
||||
% Anderson, G.
|
||||
% "Solving Linear Rational Expectations Models: A Horse Race"
|
||||
% Computational Economics, 2008, vol. 31, issue 2, pages 95-113
|
||||
%
|
||||
% Anderson, G.
|
||||
% "A Reliable and Computationally Efficient Algorithm for Imposing the
|
||||
% Saddle Point Property in Dynamic Models"
|
||||
% Journal of Economic Dynamics and Control, Forthcoming
|
||||
|
||||
function [b,rts,ia,nexact,nnumeric,lgroots,aimcode] = ...
|
||||
SPAmalg(h,neq,nlag,nlead,condn,uprbnd)
|
||||
b=[];rts=[];ia=[];nexact=[];nnumeric=[];lgroots=[];aimcode=[];
|
||||
|
|
|
@ -3,6 +3,29 @@
|
|||
% Build the companion matrix, deleting inessential lags.
|
||||
% Solve for x_{t+nlead} in terms of x_{t+nlag},...,x_{t+nlead-1}.
|
||||
|
||||
% Original author: Gary Anderson
|
||||
% Original file downloaded from:
|
||||
% http://www.federalreserve.gov/Pubs/oss/oss4/code.html
|
||||
% Adapted for Dynare by Dynare Team.
|
||||
%
|
||||
% This code in the public domain and may be used freely.
|
||||
% However the authors would appreciate acknowledgement of the source by
|
||||
% citation of any of the following papers:
|
||||
%
|
||||
% Anderson, G. and Moore, G.
|
||||
% "A Linear Algebraic Procedure for Solving Linear Perfect Foresight
|
||||
% Models."
|
||||
% Economics Letters, 17, 1985.
|
||||
%
|
||||
% Anderson, G.
|
||||
% "Solving Linear Rational Expectations Models: A Horse Race"
|
||||
% Computational Economics, 2008, vol. 31, issue 2, pages 95-113
|
||||
%
|
||||
% Anderson, G.
|
||||
% "A Reliable and Computationally Efficient Algorithm for Imposing the
|
||||
% Saddle Point Property in Dynamic Models"
|
||||
% Journal of Economic Dynamics and Control, Forthcoming
|
||||
|
||||
function [a,ia,js] = SPBuild_a(h,qcols,neq)
|
||||
|
||||
left = 1:qcols;
|
||||
|
|
|
@ -3,6 +3,29 @@
|
|||
% Copy the eigenvectors corresponding to the largest roots into the
|
||||
% remaining empty rows and columns js of q
|
||||
|
||||
% Author: Gary Anderson
|
||||
% Original file downloaded from:
|
||||
% http://www.federalreserve.gov/Pubs/oss/oss4/code.html
|
||||
% Adapted for Dynare by Dynare Team.
|
||||
%
|
||||
% This code is in the public domain and may be used freely.
|
||||
% However the authors would appreciate acknowledgement of the source by
|
||||
% citation of any of the following papers:
|
||||
%
|
||||
% Anderson, G. and Moore, G.
|
||||
% "A Linear Algebraic Procedure for Solving Linear Perfect Foresight
|
||||
% Models."
|
||||
% Economics Letters, 17, 1985.
|
||||
%
|
||||
% Anderson, G.
|
||||
% "Solving Linear Rational Expectations Models: A Horse Race"
|
||||
% Computational Economics, 2008, vol. 31, issue 2, pages 95-113
|
||||
%
|
||||
% Anderson, G.
|
||||
% "A Reliable and Computationally Efficient Algorithm for Imposing the
|
||||
% Saddle Point Property in Dynamic Models"
|
||||
% Journal of Economic Dynamics and Control, Forthcoming
|
||||
|
||||
function q = SPCopy_w(q,w,js,iq,qrows)
|
||||
|
||||
if(iq < qrows)
|
||||
|
|
|
@ -5,6 +5,29 @@
|
|||
% eigenvectors conformably. Map the eigenvectors into the real
|
||||
% domain. Count the roots bigger than uprbnd.
|
||||
|
||||
% Original author: Gary Anderson
|
||||
% Original file downloaded from:
|
||||
% http://www.federalreserve.gov/Pubs/oss/oss4/code.html
|
||||
% Adapted for Dynare by Dynare Team.
|
||||
%
|
||||
% This code is in the public domain and may be used freely.
|
||||
% However the authors would appreciate acknowledgement of the source by
|
||||
% citation of any of the following papers:
|
||||
%
|
||||
% Anderson, G. and Moore, G.
|
||||
% "A Linear Algebraic Procedure for Solving Linear Perfect Foresight
|
||||
% Models."
|
||||
% Economics Letters, 17, 1985.
|
||||
%
|
||||
% Anderson, G.
|
||||
% "Solving Linear Rational Expectations Models: A Horse Race"
|
||||
% Computational Economics, 2008, vol. 31, issue 2, pages 95-113
|
||||
%
|
||||
% Anderson, G.
|
||||
% "A Reliable and Computationally Efficient Algorithm for Imposing the
|
||||
% Saddle Point Property in Dynamic Models"
|
||||
% Journal of Economic Dynamics and Control, Forthcoming
|
||||
|
||||
function [w,rts,lgroots,flag_trouble] = SPEigensystem(a,uprbnd,rowsLeft)
|
||||
opts.disp=0;
|
||||
try
|
||||
|
|
|
@ -2,6 +2,29 @@
|
|||
%
|
||||
% Compute the exact shiftrights and store them in q.
|
||||
|
||||
% Original author: Gary Anderson
|
||||
% Original file downloaded from:
|
||||
% http://www.federalreserve.gov/Pubs/oss/oss4/code.html
|
||||
% Adapted for Dynare by Dynare Team.
|
||||
%
|
||||
% This code is in the public domain and may be used freely.
|
||||
% However the authors would appreciate acknowledgement of the source by
|
||||
% citation of any of the following papers:
|
||||
%
|
||||
% Anderson, G. and Moore, G.
|
||||
% "A Linear Algebraic Procedure for Solving Linear Perfect Foresight
|
||||
% Models."
|
||||
% Economics Letters, 17, 1985.
|
||||
%
|
||||
% Anderson, G.
|
||||
% "Solving Linear Rational Expectations Models: A Horse Race"
|
||||
% Computational Economics, 2008, vol. 31, issue 2, pages 95-113
|
||||
%
|
||||
% Anderson, G.
|
||||
% "A Reliable and Computationally Efficient Algorithm for Imposing the
|
||||
% Saddle Point Property in Dynamic Models"
|
||||
% Journal of Economic Dynamics and Control, Forthcoming
|
||||
|
||||
function [h,q,iq,nexact] = SPExact_shift(h,q,iq,qrows,qcols,neq)
|
||||
|
||||
%hs=SPSparse(h);
|
||||
|
|
|
@ -3,6 +3,29 @@
|
|||
%
|
||||
% Compute the numeric shiftrights and store them in q.
|
||||
|
||||
% Original author: Gary Anderson
|
||||
% Original file downloaded from:
|
||||
% http://www.federalreserve.gov/Pubs/oss/oss4/code.html
|
||||
% Adapted for Dynare by Dynare Team.
|
||||
%
|
||||
% This code is in the public domain and may be used freely.
|
||||
% However the authors would appreciate acknowledgement of the source by
|
||||
% citation of any of the following papers:
|
||||
%
|
||||
% Anderson, G. and Moore, G.
|
||||
% "A Linear Algebraic Procedure for Solving Linear Perfect Foresight
|
||||
% Models."
|
||||
% Economics Letters, 17, 1985.
|
||||
%
|
||||
% Anderson, G.
|
||||
% "Solving Linear Rational Expectations Models: A Horse Race"
|
||||
% Computational Economics, 2008, vol. 31, issue 2, pages 95-113
|
||||
%
|
||||
% Anderson, G.
|
||||
% "A Reliable and Computationally Efficient Algorithm for Imposing the
|
||||
% Saddle Point Property in Dynamic Models"
|
||||
% Journal of Economic Dynamics and Control, Forthcoming
|
||||
|
||||
function [h,q,iq,nnumeric] = SPNumeric_shift(h,q,iq,qrows,qcols,neq,condn)
|
||||
|
||||
nnumeric = 0;
|
||||
|
|
|
@ -14,6 +14,29 @@
|
|||
%
|
||||
% scof observable structure coefficients
|
||||
|
||||
% Original author: Gary Anderson
|
||||
% Original file downloaded from:
|
||||
% http://www.federalreserve.gov/Pubs/oss/oss4/code.html
|
||||
% Adapted for Dynare by Dynare Team.
|
||||
%
|
||||
% This code is in the public domain and may be used freely.
|
||||
% However the authors would appreciate acknowledgement of the source by
|
||||
% citation of any of the following papers:
|
||||
%
|
||||
% Anderson, G. and Moore, G.
|
||||
% "A Linear Algebraic Procedure for Solving Linear Perfect Foresight
|
||||
% Models."
|
||||
% Economics Letters, 17, 1985.
|
||||
%
|
||||
% Anderson, G.
|
||||
% "Solving Linear Rational Expectations Models: A Horse Race"
|
||||
% Computational Economics, 2008, vol. 31, issue 2, pages 95-113
|
||||
%
|
||||
% Anderson, G.
|
||||
% "A Reliable and Computationally Efficient Algorithm for Imposing the
|
||||
% Saddle Point Property in Dynamic Models"
|
||||
% Journal of Economic Dynamics and Control, Forthcoming
|
||||
|
||||
function scof = SPObstruct(cof,cofb,neq,nlag,nlead)
|
||||
|
||||
|
||||
|
|
|
@ -2,6 +2,29 @@
|
|||
%
|
||||
% Compute reduced-form coefficient matrix, b.
|
||||
|
||||
% Original author: Gary Anderson
|
||||
% Original file downloaded from:
|
||||
% http://www.federalreserve.gov/Pubs/oss/oss4/code.html
|
||||
% Adapted for Dynare by Dynare Team.
|
||||
%
|
||||
% This code is in the public domain and may be used freely.
|
||||
% However the authors would appreciate acknowledgement of the source by
|
||||
% citation of any of the following papers:
|
||||
%
|
||||
% Anderson, G. and Moore, G.
|
||||
% "A Linear Algebraic Procedure for Solving Linear Perfect Foresight
|
||||
% Models."
|
||||
% Economics Letters, 17, 1985.
|
||||
%
|
||||
% Anderson, G.
|
||||
% "Solving Linear Rational Expectations Models: A Horse Race"
|
||||
% Computational Economics, 2008, vol. 31, issue 2, pages 95-113
|
||||
%
|
||||
% Anderson, G.
|
||||
% "A Reliable and Computationally Efficient Algorithm for Imposing the
|
||||
% Saddle Point Property in Dynamic Models"
|
||||
% Journal of Economic Dynamics and Control, Forthcoming
|
||||
|
||||
function [nonsing,b] = SPReduced_form(q,qrows,qcols,bcols,neq,condn);
|
||||
b=[];
|
||||
%qs=SPSparse(q);
|
||||
|
|
|
@ -5,6 +5,29 @@ function [y] = SPShiftright(x,n)
|
|||
% Shift the rows of x to the right by n columns, leaving zeros in the
|
||||
% first n columns.
|
||||
|
||||
% Original author: Gary Anderson
|
||||
% Original file downloaded from:
|
||||
% http://www.federalreserve.gov/Pubs/oss/oss4/code.html
|
||||
% Adapted for Dynare by Dynare Team.
|
||||
%
|
||||
% This code is in the public domain and may be used freely.
|
||||
% However the authors would appreciate acknowledgement of the source by
|
||||
% citation of any of the following papers:
|
||||
%
|
||||
% Anderson, G. and Moore, G.
|
||||
% "A Linear Algebraic Procedure for Solving Linear Perfect Foresight
|
||||
% Models."
|
||||
% Economics Letters, 17, 1985.
|
||||
%
|
||||
% Anderson, G.
|
||||
% "Solving Linear Rational Expectations Models: A Horse Race"
|
||||
% Computational Economics, 2008, vol. 31, issue 2, pages 95-113
|
||||
%
|
||||
% Anderson, G.
|
||||
% "A Reliable and Computationally Efficient Algorithm for Imposing the
|
||||
% Saddle Point Property in Dynamic Models"
|
||||
% Journal of Economic Dynamics and Control, Forthcoming
|
||||
|
||||
[rows,cols] = size(x);
|
||||
|
||||
left = 1:cols-n;
|
||||
|
|
Loading…
Reference in New Issue