Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Mata data question

Subject   st: Mata data question
Date   Wed, 03 Aug 2011 09:18:19 -0500

Benjamin Allaire <> 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

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


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.

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index