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: Identify reciprocated ties in directed network with -netsis-
From
Nick Cox <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: Identify reciprocated ties in directed network with -netsis-
Date
Sat, 15 Jun 2013 11:16:26 +0100
I have not used -netsis- (from SJ 12-1; please explain _where_
user-written programs you refer to come from) but this appears to
yield easily to a simple trick.
gen first = cond(source < target, source, target)
gen second = cond(source < target, target, source)
bysort month first second : gen recip = mod(_N, 2) == 0
Inequalities apply to strings as well as numbers, e.g.
. di ("James" < "Keira")
1
so sorting reduces pairs to comparable form ("James" "Keira" and
"Keira" "James" both are sorted to "James" "Keira" and 7 42 and 42
7 are both sorted to 7 42).
See
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
http://www.stata-journal.com/sjpdf.html?articlenum=dm0043
for more.
Nick
[email protected]
On 15 June 2013 10:15, Claudio Tagliapietra
<[email protected]> wrote:
> I am using -netsis- in Stata 12.1 SE in Windows 7, to analyze a directed network. The data is stored as an arc list, as follows
>
> Example 1. Input.
>
> month source target
> ------------------------------
> 1 Andrew Peter
> 1 Peter Andrew
> 1 James Peter
> 2 Peter James
> 2 Andrew Peter
> 2 James Peter
>
> "source" and "target" are stored as integer ids.
>
> I want to create a dummy "recipr" that indicates which ties (arcs) are reciprocated in each month. The output should be:
>
> Example 2. Output.
>
> month source target recipr
> -----------------------------------------
> 1 Andrew Peter 1
> 1 Peter Andrew 1
> 1 James Peter 0
> 2 Peter James 1
> 2 Andrew Peter 0
> 2 James Peter 1
>
> Is this currently possible with -netsis-?
> Alternatives?
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/