snowdrop.src.numeric.solver.AIM package¶
Submodules¶
snowdrop.src.numeric.solver.AIM.AIMsolver module¶
- snowdrop.src.numeric.solver.AIM.AIMsolver.AIMsolver(jacobian, c, model, suppress_warnings=False)[source]¶
Maps jacobian to AIM 1st order model solver designed and developed by Gary Anderson and derives the solution for ghx and ghu from the AIM outputs.
AIM System is given as a sum: i.e. for i=-$…+& SUM(Hi*xt+i)= £*zt, t = 0, … ,? and its input as single array of matrices: [H-$… Hi … H+&] and its solution as xt=SUM( Bi*xt+i) + @*£*zt for i=-$…-1 with the output in form bb=[B-$… Bi … B-1] and @=inv(Ho+H1*B-1) jacobian = [fy’-$… fy’i … fy’+& fu’] where [fy’-$… fy’i … fy’+&]=[H-$… Hi … H+&] and fu’= £
- INPUTS
jacobian [matrix] 1st order derivatives of the model’s equations model [object] Definition of the model.
- OUTPUTS
aimcode [integer] 1: the model defines variables uniquely aimcode is resolved in AIMerr as
1: unique solution. 2: roots not correctly computed by real_schur. 3: too many big roots. 35: too many big roots, and q(:,right) is singular. 4: too few big roots. 45: too few big roots, and q(:,right) is singular. 5: q(:,right) is singular. 61: too many exact shiftrights. 62: too many numeric shiftrights. 63: A is NAN or INF. 64: problem in SPEIG.
else: return code not properly specified.
snowdrop.src.numeric.solver.AIM.Aimerr module¶
- snowdrop.src.numeric.solver.AIM.Aimerr.Aimerr(c)[source]¶
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
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, 2010, vol. 34, issue 3, pages 472-489
snowdrop.src.numeric.solver.AIM.Amalg module¶
- snowdrop.src.numeric.solver.AIM.Amalg.Amalg(h, neq, nlag, nlead, condn, uprbnd)[source]¶
Solve a linear perfect foresight model using the matlab eig function to find the invariant subspace associated with the big roots. This procedure will fail if the companion matrix is defective and does not have a linearly independent set of eigenvectors associated with the big roots.
Input arguments:
h Structural coefficient matrix (neq,neq*(nlag+1+nlead)). neq Number of equations. nlag Number of lags. nlead Number of leads. condn Zero tolerance used as a condition number test
by numeric_shift and reduced_form.
- uprbnd Inclusive upper bound for the modulus of roots
allowed in the reduced form.
Output arguments:
b Reduced form coefficient matrix (neq,neq*nlag). rts Roots returned by eig. ia Dimension of companion matrix (number of non-trivial
elements in rts).
nexact Number of exact shiftrights. nnumeric Number of numeric shiftrights. lgroots Number of roots greater in modulus than uprbnd. aimcode Return code: see function aimerr.
Original author: Gary Anderson Original file downloaded from: http://www.federalreserve.gov/Pubs/oss/oss4/code.html
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, 2010, vol. 34, issue 3, pages 472-489
snowdrop.src.numeric.solver.AIM.Eigensystem module¶
- snowdrop.src.numeric.solver.AIM.Eigensystem.Eigensystem(a, uprbnd, rowsLeft)[source]¶
Compute the roots and the left eigenvectors of the companion matrix, sort the roots from large-to-small, and sort the 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
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, 2010, vol. 34, issue 3, pages 472-489
snowdrop.src.numeric.solver.AIM.Obstruct module¶
- snowdrop.src.numeric.solver.AIM.Obstruct.Obstruct(cof, cofb, neq, nlag, nlead)[source]¶
Construct the coefficients in the observable structure.
- Input arguments:
cof structural coefficients cofb reduced form neq number of equations nlag number of lags nlead number of leads
- Output arguments:
scof observable structure coefficients
Original author: Gary Anderson Original file downloaded from: http://www.federalreserve.gov/Pubs/oss/oss4/code.html
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, 2010, vol. 34, issue 3, pages 472-489
snowdrop.src.numeric.solver.AIM.Shifts module¶
- This file contains the following functions:
Exact_shift, Numeric_shift, Shiftright
Original author: Gary Anderson Original file downloaded from: http://www.federalreserve.gov/Pubs/oss/oss4/code.html
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, 2010, vol. 34, issue 3, pages 472-489
snowdrop.src.numeric.solver.AIM.buildA module¶
- snowdrop.src.numeric.solver.AIM.buildA.buildA(h, qcols, neq)[source]¶
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
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, 2010, vol. 34, issue 3, pages 472-489
snowdrop.src.numeric.solver.AIM.checkA module¶
Functions to check if the matrix a contains any NaN or Inf values
Created by: Jason Sockin Date: September 11, 2013
snowdrop.src.numeric.solver.AIM.copyW module¶
- snowdrop.src.numeric.solver.AIM.copyW.copyW(qq, ww, js, iq, qrows)[source]¶
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
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, 2010, vol. 34, issue 3, pages 472-489
snowdrop.src.numeric.solver.AIM.makeF module¶
This function calculates the F matrix used in the AMA algorithm.
snowdrop.src.numeric.solver.AIM.makePhi module¶
This function calculates the phi matrix used in the AMA algorithm.
snowdrop.src.numeric.solver.AIM.makeVartheta module¶
This function calculates the Vartheta matrix used in the AMA algorithm.
snowdrop.src.numeric.solver.AIM.reducedForm module¶
- snowdrop.src.numeric.solver.AIM.reducedForm.reducedForm(qq, qrows, qcols, bcols, neq, condn)[source]¶
Compute reduced-form coefficient matrix, b.
Original author: Gary Anderson Original file downloaded from: http://www.federalreserve.gov/Pubs/oss/oss4/code.html
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, 2010, vol. 34, issue 3, pages 472-489