[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Mike Lacy <Michael.Lacy@colostate.edu> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: convert adjacency to edgelist |

Date |
Sat, 14 Feb 2009 10:35:15 -0700 |

> >Date: Fri, 13 Feb 2009 16:25:36 -0500 >From: "Victor, Jennifer Nicoll" <jnvictor@pitt.edu> >Subject: st: convert adjacency to edgelist > >Hello Stata users, > >I have a 438x438 adjacency matrix (symmetrical, non-directed) where >the cells are the number of connections between each i,j pair (the >pairs are members of congress and the connections are the number of >caucuses each pair is in). I have it in Excel format, csv format, and >Stata format. I also have it in Stata as a dyadic dataset with >attribute variables (N=95,703). I want to convert either the dyadic >data or the adjacency matrix to an edgelist that I could import into R >(igraph) or NodeXL or TouchGraph so that I can make a network graph or >two, but I need an edgelist to import into those programs.

(i.e, given a Stata data set of the form: (non-proportional font on) +------------------------------+ | egoid x1 x2 x3 x4 x5 | |------------------------------| 1. | 1 . 2 2 0 1 | 2. | 2 . . 0 3 3 | 3. | 3 . . . 2 2 | 4. | 4 . . . . 2 | 5. | 5 . . . . . | +------------------------------+ (where x_i is the number of connnections from egoid to i) Then reshape long x, i(ego) j(alter) drop if missing(x) would yield what I would call an edge list in Stata. +-----------------+ | ego alter x | |-----------------| 1. | 1 2 2 | 2. | 1 3 2 | 3. | 1 4 0 | 4. | 1 5 1 | 5. | 2 3 0 | |-----------------| 6. | 2 4 3 | 7. | 2 5 3 | 8. | 3 4 2 | 9. | 3 5 2 | 10. | 4 5 2 | +-----------------+ Regards, =-=-=-=-=-=-=-=-=-=-=-=-= Mike Lacy Fort Collins CO USA (970) 491-6721 office * * 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/

- Prev by Date:
**Re: st: Mata version control** - Next by Date:
**st: change directory using locals** - Previous by thread:
**st: convert adjacency to edgelist** - Next by thread:
**st: Mata version control** - Index(es):

© Copyright 1996–2016 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |