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 11:50:35 -0400
Thank you! This was so helpful!
Also, are there any plans to include a k-nn matrix in the near future?
----- Original Message -----
From: [email protected]
Date: Thursday, March 31, 2011 10:51 am
Subject: st: sppack [was: SSPACK]
To: [email protected]
> Ashley Arnio [email protected] asked about using the user-written -<BR>> spmat- command
> to create spatial-weighting matrices with weights that are
> inversely related to
> the square distances between the spatial units:
>
> > Is it possible to create an inverse distance squared spatial matrix
> > using 'spmat'?
>
> I will illustrate with the ancilliary pollute.dta dataset that
> comes with the
> sppack suite.
>
> First, create an spmat object containing an inverse-distance
> spatial-weighting
> matrix
>
> . use polltue, clear
> . spmat idistance dobj longitude latitude, id(id)
> dfunction(dhaversine)
> Now the spatial-weighting matrix, call it W, is contained in the
> spmat object
> dobj. Ashley wishes to square each element of W. To do so, we
> extract the
> matrix from the spmat object into Mata memory and perform the desired
> calculation
>
> . spmat getmatrix dobj W id
> . mata: W = W:^2
>
> Now we put the transformed matrix back into the spmat object
>
> . spmat putmatrix dobj W id, replace
>
> This technique is illustrated in the working paper 'Creating and
> managingspatial-weighting matrices using the spmat command',
> available at
> http://econweb.umd.edu/~prucha/Papers/WP_spmat_2011.pdf.
>
> --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/