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]

Re: st: spatial weights which also take into account time

From   Nick Cox <>
Subject   Re: st: spatial weights which also take into account time
Date   Thu, 31 Jan 2013 18:18:37 +0000

I doubt that you are missing anything because I said almost everything
I had in mind. All that I was suggesting was that if you want spatial
weights to be based only on recent data the calculation should be
restricted by an -if- condition that selects observations that are

You had a general question on weights in space and time and a specific
question on -spwmatrix-, which is fine by me. But I didn't write and
have never used the latter and, as said, don't advise specifically on
it. For better advice, you may need to email P. Wilner Jeanty if he or
some other expert doesn't speak up.


On Thu, Jan 31, 2013 at 6:08 PM, Ben Hoen <> wrote:
> Thanks Nick,
> Though, I am not sure think I understand.  Are suggesting calculating a knn
> weights matrix and interacting it with some expression that would limit the
> data based on time?  Would this account for the fact that each interaction
> is based on the target case's "time" (i.e., only those nn that transacted
> within the previous 1 year from the target cases date) and therefore would
> be a "moving window" of time for each transaction?
> I expect that I am missing some significant aspect of your response b/c of
> my limited understanding of how to employ weights.
> Ben
> Ben Hoen
> Office: 845-758-1896
> Cell: 718-812-7589
> -----Original Message-----
> From:
> [] On Behalf Of Nick Cox
> Sent: Thursday, January 31, 2013 12:05 PM
> To:
> Subject: Re: st: spatial weights which also take into account time
> A very general answer is
> 1. Many programs support weights of various kinds.
> 2. If you want your weights to depend on several variables, that's
> often fine: you just have to compute them.
> 3. The syntax is typically [<weighttype> = <exp>] so that the <exp>
> can depend on several variables. Often it would be a product or a
> dividend.
> 4. The general syntax (literally -syntax-) for checking weights and
> the specific ways that weights are handled within a program should be
> considered separate matters. (At the worst end, I've seen user
> programs support specification of weights but then ignore them, it
> being supposed by novice programmers that it's sufficient to allow
> weights via a -syntax- statement.)
> All that said, your specific problem sounds like a case for using an
> -if- restriction, not more complicated weights, but I can't comment
> authoritatively on -spwmatrix-.
> Nick
> On Thu, Jan 31, 2013 at 4:51 PM, Ben Hoen <> wrote:
>> I have been unsuccessful in my search this morning for a way to deal with
>> both space and time (or for that matter any other variable other than
> space)
>> in developing a spatial weights matrix.  ALERT: I am a novice - slowly
>> learning - about spatial models.
>> The k nearest neighbors options in some user written programs (e.g.,
>> spwmatrix - SSC) allows me to limit the number of neighbors based on
>> "nearness".  Alternatively I could use some cutoff distance (e.g., 1 mile)
>> to limit the collection of "neighbors".  But in addition to distance I
> would
>> like to use time to limit my data.  For example I have home transactions
>> that I want to test for spatial autocorrelation between.  I concern myself
>> with BOTH the k (e.g., 5) nearest neighbors that ALSO transacted within
> the
>> previous year.  (I.e., using a transaction that occurred, for example, 10
>> years later does not make sense, even if it is "nearest".)
>> Are there any ideas out there for how to limit the data based on both
> space
>> AND time in developing the weights matrix?
*   For searches and help try:

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