Bookmark and Share

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]

st: RE: Preventing double counting


From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: RE: Preventing double counting
Date   Thu, 8 Dec 2011 12:45:40 +0000

In addition to Brendan's suggestion, you can check consistency like this: 

gen first = min(orig, dest)
gen second = max(orig, dest)
bysort first second : assert _N == 1 if first == second 
by first second: assert _N == 2 if first < second 
by first second : assert netmigration[1] == -netmigration[_N] 

See also 

SJ-8-4  dm0043  . Tip 71: The problem of split identity, or how to group dyads
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
        Q4/08   SJ 8(4):588--591                                 (no commands)
        tip on how to handle dyadic identifiers

Nick 
[email protected] 

Michael Betz

I have state-to-state migration data that is as follows:

orig_state	dest_state	netmigration
1		1		0	
2		1		25
3		1		.
1		2		-25
2		2		0
3		2		44
1		3		.
2		3		-44
3		3		0


There is an origin state, a destination state, and net migration between the two. I don't want to double count net migration so I only want to keep a single observation for each state pair. Does anyone have any suggestions about how I could get rid of the second observation that gives me the negative net migration of the first observation?


*
*   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/


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