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: data manipulation question
From
Scott Merryman <[email protected]>
To
[email protected]
Subject
Re: st: data manipulation question
Date
Wed, 11 Aug 2010 07:31:47 -0500
Perhaps you could explain in more detail how the move_nnj variables
are generated in your example.
It is not clear why for id = 1, quarter = 2, move = 0 the move_nn1
and move_nn2 = 2. Then in quarter =3, move = 1 and now move_nn3 = 2?
Scott
On Tue, Aug 10, 2010 at 6:23 PM, DC <[email protected]> wrote:
> Hi All,
>
> I have a question about the correct procedure to assign indicators of
> events occurring to nearest neighbors to individual identifiers .
> Specifically, I have data that look something like this:
>
> id race quarter move nn1 nn2 nn3
> 1 1 1 0 2 3 4
> 1 1 2 0 2 3 4
> 1 1 3 1 2 3 4
> 2 0 1 0 1 4 3
> 2 0 1 1 1 4 3
> 3 0 1 0 5 1 4
> 3 0 2 1 5 1 4
> 4 0 1 0 3 2 5
> 4 0 2 0 3 2 5
> 4 0 3 1 3 2 5
> 5 1 1 0 5 2 1
> 5 1 2 1 5 2 1
>
> where id, race, quarter, and move are pretty straight forward. nn1,
> nn2, nn3 denote a ranking of the 3 nearest neighbors to unit_ i.
>
> I would like to construct indicators first denoting whether unit_ i
> saw a move in nn_ j in quarter_ t. Conditional on seeing a move in
> nn_ j
> I would like to assign a racial indicator. In other words, something like this:
>
> id race quarter move nn1 nn2 nn3 move_nn1
> move_nn2 move_nn3
> 1 1 1 0 2 3 4
> 0 0 0
> 1 1 2 0 2 3 4
> 2 2 0
> 1 1 3 1 2 3 4
> 0 0 2
> 2 2 1 0 1 4 3
> 0 0 0
> 2 2 2 1 1 4 3
> 0 0 2
> 3 2 1 0 5 1 4
> 0 0 0
> 3 2 2 1 5 1 4
> 1 0 0
> 4 2 1 0 3 2 5
> 0 0 0
> 4 2 2 0 3 2 5
> 2 2 1
> 4 2 3 1 3 2 5
> 0 0 0
> 5 1 1 0 3 2 1
> 0 0 0
> 5 1 2 1 3 2 1
> 2 2 0
>
>
> It is a bit complicated. Any help would be greatly appreciated.
>
> Regards,
> Marcus
*
* 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/