Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | rraciborski@stata.com |
To | statalist@hsphsun2.harvard.edu |
Subject | st: Mata data question |
Date | Wed, 03 Aug 2011 09:18:19 -0500 |
Benjamin Allaire <btallaire@hotmail.com> reported a problem with the user-written -spmat- command. Benjamin tried to band a matrix contained in the spmat object Gsp but -spmat tobanded- complained: . spmat tobanded Gsp, replace spmat object Gsp not found r(498); The correct error message should have told Benjamin that the bands were too wide for the matrix to be stored in a banded form. We will fix the error message in a future update to -spmat-. As the help file for -spmat tobanded- explains, the bands must be less or equal to floor((cols(W)-1)/4) where W stands for the spatial-weighting matrix. In Benjamin's case, the above expression evaluates to 2 but his matrix has a band of 3. To avoid such error messages in the future, Benjamin can string together -spmat summarize- and -spmat tobanded- as follows . qui spmat summarize Gsp, banded . if `r(canband)' spmat tobanded Gsp, dtruncate(`r(lband)' `r(uband)') replace The help file for -spmat summarize- explains the saved results I used in the code above. --Rafal rraciborski@stata.com * * 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/