Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • -nw_fromlist- now on SSC

    Thanks to Kit Baum, -nw_fromlist- a program that allows you to generate networks from lists (long data), is on SSC.

    While my previous programs dealt with extracting information from network data on Stata, this one is one step before and allows you to create networks from a list of individuals on nodes.

    Before showing an example I detail a little the network analysis. While most econometrics works tries to determined how a variable y is determined by another variable x1, the network analysis provides another perspective (which could be seen a extended descriptive statistics) and gives information on how various (discrete) values of y are associated by individual (or any observation scale). Precise metrics of nodes (each value of y), can be returned and used in a more traditional econometric analysis.

    Example : Multinational firms and host countries :
    Multinational firms (here my individuals), are located in various host countries. But what kind of countries are jointly invested? Which country is "central" and linked to many other? These questions might be addressed by a network analysis. (Replace country by any discrete variable, and firms by any individual that fit your research topic).

    nw_fromlist allows you to build a network simply from a long dataset on individual (here firms) on nodes (here countries). Eg:

    Code:
    *Before running this code, you must install Thomas Grund nwcommand I use in my code, by uncommenting next line
    *net install nwcommands-ado, from(http://www.nwcommands.org)
    
    nwclear
    input byte ent str4 iso3 float(year)
    1 "AUT" 1
    1 "USA" 2
    2 "USA" 1
    2 "GBR"  1 
    3 "GBR"  2
    3 "FRA" 2
    3 "ESP" 1
    4 "ESP" 1
    4 "ITA" 1
    4 "FRA" 2
    4 "USA" 3
    
    end
    . nw_fromlist mynetwork,node(iso3) id(ent)
     nwplot, edgesize(mynetwork) label(iso3)
    The program has drawn a network from the long data format. Then a quick network analysis shows that USA are the most central node here.

    nw_fromlist also has options to built directed, binary or normalized networks, see the help file for preciser information.


    I hope some of you will find it useful and give a try, at least to see what could bring a network analysis in your topics, with a very low entry cost.

    Best, and thank again to Thomas Grund, since I'm relying much on is substantial existing work.


    Charlie



  • #2
    Many thanks Charlie! This is a great program!

    I have a dataset with physicians id working in different hospitals in different years/months. I would like to model networks of physicians for each hospital at each period of time. In the example below, I have 3 hospitals and 2 periods, therefore I should have 6 networks. Can you help me use
    HTML Code:
    nw_fromlist
    to create the 6 networks from the data below? Many thanks!

    Code:
    clear
    input str1 hosp_id period str1 phy_id
    "i" 1 "A"
    "i" 1 "B"
    "i" 1 "C"
    "i" 1 "D"
    "i" 2 "A"
    "i" 2 "B"
    "i" 2 "C"
    "i" 2 "D"
    "j" 1 "B"
    "j" 1 "C"
    "j" 1 "E"
    "j" 2 "B"
    "j" 2 "C"
    "j" 2 "E"
    "k" 1 "B"
    "k" 1 "F"
    "k" 2 "G"
    end

    Comment


    • #3
      Dear Paula,

      What is your relational variable? What ties two physicians?
      My program could link the physicians according if they work at the same hospital for example, but it would be meaningless to build such network at the hospital level (complete graph).

      Anyway, if you want to create several networks for each period (and/or each hospital), you can do a simple loop e.g.
      Code:
      forvalues j=startyear/endyear{
      preserve
      keep if year==`j'
      nwfromlist net_`j', node(nodevar) id(individual_id)
      restore
      }
      I hope this helps.

      NB: Please use the attached version of nw_fromlist code, it fixes some bugs, and have additional options.


      Attached Files

      Comment

      Working...
      X