Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[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–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index