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: spmat idistance error

Subject   st: spmat idistance error
Date   Mon, 30 Jan 2012 09:42:25 -0600

Ajita Atreya <> is trying to create a banded
spatial-weighting matrix using the user-written -spmat- command but -spmat-

> I have 24,000 observations on property prices. I am trying to create an
> inverse distance matrix with truncation (200m) to use in spreg command. 
> I used the following code to create inverse distance matrix:
> spmat idistance longitude latitude, id(id) dfunction(dhaversine)
> vtruncate(1/.2) normalize(minmax) banded
> The matrix was created once but when I re did it I started getting the error
> as: Object not created-bands must be<=5516
> The model I am using is :
> spreg g2sls lnprice ........, id(id) dlmat(matrixname) elmat(matrixname)

We would need to see all the syntax that Ajita typed to diagnose the problem.

Meanwhile, I can offer some general thoughts.  Ajita typed

  . spmat idistance longitude latitude, id(id) ...

This statement should have created an spmat object named "longitude"; my guess
is that Ajita meant to type something similar to

  . spmat idistance myobj longitude latitude, id(id) ...
and -spmat- would have created an spmat object named "myobj".

Whatever the case, the syntax for -spreg- would not work as in

  . spreg gs2sls ..., id(id) dlmat(matrixname) elmat(matrixname)

options dlmat() and elmat() expect the name of an spmat object and from the
code Ajita showed us, there is no spmat object named "matrixname".

Re: banded matrices, Ajita should read section 5 of the spmat working paper,
available at, too see
whether the sorting trick described therein helps with banding the matrix.

Finally, if Ajita has not done so, Ajita should also update -spmat- and
-spreg- (and -spivreg-) to the latest version by typing

  . ssc install sppack, replace

The updated code is slightly more memory efficient than the old version.

*   For searches and help try:

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