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]
Re: st: sppack [was: SSPACK]
From
Ashley Arnio <[email protected]>
To
[email protected]
Subject
Re: st: sppack [was: SSPACK]
Date
Thu, 31 Mar 2011 17:21:42 -0400
Thank you! This made my semester!
----- Original Message -----
From: [email protected]
Date: Thursday, March 31, 2011 2:31 pm
Subject: st: sppack [was: SSPACK]
To: [email protected]
> Ashley Arnio <[email protected]> asked about creating k-nearest-
> neighbor (KNN)
> spatial-weighting matrices:
>
> > Are there any plans to include a k-nn matrix in the near future?
>
> Ashley can use -spmat idistance- with the undocumented option -
> knn()- to create
> a KNN spatial-weighting matrix. I will illustrate with the ancillary
> pollute.dta dataset that comes with the sppack suite.
>
> . use pollute, clear
> . spmat idistance dobj longitude latitude, id(id)
> dfunction(dhaversine) knn(5)
>
> -spmat idistance ..., knn(5)- creates a spatial-weighting matrix in
> which the
> five nearest neighbors of each spatial unit are weighted by their
> inversedistances and all others recieive zero weights. We can use -
> spmat summarize-
> with the option -links- to verify that each spatial unit has indeed
> fiveneighbors.
>
> . spmat summarize dobj
>
> We did not document the -knn()- option because the command is slow
> for large
> problems. We plan to address this issue in the future.
>
> --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/
>
*
* 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/