Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Sam Schulhofer-Wohl <sschulh1.work@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | st: new package smwoodbury |
Date | Tue, 3 Jan 2012 15:19:02 -0600 |
Thanks to Kit Baum, a new package -smwoodbury- is available for download from SSC. -smwoodbury- provides Mata functions that implement the Sherman-Morrison-Woodbury formula for a rank-k update to a matrix inverse and that use the formula to efficiently solve matrix equations. The formula is: inv(A+U*C*V) = inv(A) - inv(A)*U*inv(inv(C)+V*inv(A)*U)*V*inv(A), where A is NxN, U is NxK, C is KxK, and V is KxN. Use of this formula can save computation time when N is much larger than K and either inv(A) is easy to calculate or inv(A+U*C*V) must be calculated many times for different values of U, C and V. Such situations arise, for example, in Markov chain Monte Carlo estimation of mixed models. The package provides functions that are optimized for a variety of special cases, such as U=V' or A=I. In addition, functions are provided that efficiently solve the equation (A+U*C*V)*X = Y for X without directly inverting A+U*C*V. -- Sam Schulhofer-Wohl Senior Economist Research Department Federal Reserve Bank of Minneapolis 90 Hennepin Ave. Minneapolis MN 55480-0291 (612) 204-5484 wohls@minneapolisfed.org Views expressed herein are those of the author and not necessarily those of the Federal Reserve Bank of Minneapolis or the Federal Reserve System. * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/