Bookmark and Share

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


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

st: Mata data question


From   [email protected]
To   [email protected]
Subject   st: Mata data question
Date   Wed, 03 Aug 2011 09:18:19 -0500

Benjamin Allaire <[email protected]> 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
[email protected]
*
*   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/


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