Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Ajita Atreya <ajita63@hotmail.com> |
To | <statalist@hsphsun2.harvard.edu> |
Subject | RE: st: spmat idistance error |
Date | Mon, 30 Jan 2012 19:27:34 +0000 |
Hi Rafal, Sorry about the confusion in my code. I actually have a name for spmat object which I missed to type. My code is: spmat idistance idoug longitude latitude, id(id) dfunction(dhaversine) vtruncate(1/.2) normalize(minmax) banded ****idoug is the name of my spmat object which I want to use in spreg command The command I used for running spatial regression is spreg g2sls lnprice ........, id(id) dlmat(idoug) elmat(idoug) My question here is can stata form a banded inverse-distance matrix (24,000 obs) that I can use in my Spreg command. I have read the spmat working paper and did exactly the same thing to band a matrix that is described but unfortunately it did not work.However, the same banding process works well with the contiguity matrix.Please suggest alternative if any ThanksAjita ---------------------------------------- > From: rraciborski@stata.com > To: statalist@hsphsun2.harvard.edu > Subject: st: spmat idistance error > Date: Mon, 30 Jan 2012 09:42:25 -0600 > > Ajita Atreya <ajita63@hotmail.com> is trying to create a banded > spatial-weighting matrix using the user-written -spmat- command but -spmat- > complains: > > > 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 http://econweb.umd.edu/~prucha/Papers/WP_spmat_2011.pdf, 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. > > --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/ * * 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/