Hello.
I am looking for help with the nwcommands or other Stata network analysis options, particularly with structuring my data in a way that nwcommands will read. I have found the resources on the nwcommands very helpful for analysis, but I am working with a raw dataset that needs to be reformatted before it is compatible with these commands. I have a dataset of n=15 sociocentric networks formatted in a wide form – with ego and alter ties and attributes across one row (see sample data below). An ego can have between 0 and 20 alters and the edges between alters are undirected and weighted (1=strangers; 2=in-between; 3=especially close). My goal is to compute basic network structure characteristic variables for each network and summarize the network characteristics across the 15 networks, as well as map each network. I would appreciate any advice regarding how to reformat these data either to an edgelist or adjacency matrix – given that each observation in the current dataset represents a distinct network, I believe the solution involves 15 edgelists or matrices. To give a sense of the data, I have provided a sample of variables for 5 alters and created data for 2 observations/egos.
Example data:
Variable description:
I am looking for help with the nwcommands or other Stata network analysis options, particularly with structuring my data in a way that nwcommands will read. I have found the resources on the nwcommands very helpful for analysis, but I am working with a raw dataset that needs to be reformatted before it is compatible with these commands. I have a dataset of n=15 sociocentric networks formatted in a wide form – with ego and alter ties and attributes across one row (see sample data below). An ego can have between 0 and 20 alters and the edges between alters are undirected and weighted (1=strangers; 2=in-between; 3=especially close). My goal is to compute basic network structure characteristic variables for each network and summarize the network characteristics across the 15 networks, as well as map each network. I would appreciate any advice regarding how to reformat these data either to an edgelist or adjacency matrix – given that each observation in the current dataset represents a distinct network, I believe the solution involves 15 edgelists or matrices. To give a sense of the data, I have provided a sample of variables for 5 alters and created data for 2 observations/egos.
Example data:
ID_ego | node_a | node_b | node_c | node_d | node_e | sn_close_a | sn_close_b | sn_close_c | sn_close_d | sn_close_e | sn_relate_ab | sn_relate_ac | sn_relate_ad | sn_relate_ae | sn_relate_bc | sn_relate_bd | sn_relate_be | sn_relate_cd | sn_relate_ce | sn_relate_de |
50 | 1 | 1 | 1 | 1 | 2 | 1 | 1 | 2 | 1 | . | 1 | 2 | 3 | . | 3 | 3 | . | 2 | . | . |
51 | 1 | 2 | 1 | 1 | 2 | 1 | . | 2 | 1 | . | . | 2 | 3 | . | . | . | . | 2 | . | . |
Variable | Obs | Unique | Min | Max | Label |
ID_ego | 15 | 15 | 50 | 65 | unique id number for network ego |
node_a | 15 | 1 | 1 | 1 | Keep=1 or remove =2 alter a |
node_b | 15 | 2 | 1 | 2 | Keep=1 or remove =2 alter b |
node_c | 15 | 2 | 1 | 2 | Keep=1 or remove =2 alter c |
node_d | 15 | 2 | 1 | 2 | Keep=1 or remove =2 alter d |
node_e | 15 | 2 | 1 | 2 | Keep=1 or remove =2 alter e |
sn_close_a | 15 | 2 | 1 | 2 | Ego closeness with alter a (1=very close; 2=not as close) |
sn_close_b | 11 | 2 | 1 | 2 | Ego closeness with alter b (1=very close; 2=not as close) |
sn_close_c | 10 | 2 | 1 | 2 | Ego closeness with alter c (1=very close; 2=not as close) |
sn_close_d | 9 | 2 | 1 | 2 | Ego closeness with alter d (1=very close; 2=not as close) |
sn_close_e | 7 | 2 | 1 | 2 | Ego closeness with alter e (1=very close; 2=not as close) |
sn_relate_ab | 11 | 2 | 2 | 3 | relationship of alter a & b (1=strangers; 2=in-between; 3=very close) |
sn_relate_ac | 10 | 3 | 1 | 3 | relationship of alter a & c (1=strangers; 2=in-between; 3=very close) |
sn_relate_ad | 9 | 3 | 1 | 3 | relationship of alter a & d (1=strangers; 2=in-between; 3=very close) |
sn_relate_ae | 7 | 3 | 1 | 3 | relationship of alter a & e (1=strangers; 2=in-between; 3=very close) |
sn_relate_bc | 8 | 2 | 2 | 3 | relationship of alter b & c (1=strangers; 2=in-between; 3=very close) |
sn_relate_bd | 7 | 3 | 1 | 3 | relationship of alter b & d (1=strangers; 2=in-between; 3=very close) |
sn_relate_be | 5 | 3 | 1 | 3 | relationship of alter b & e (1=strangers; 2=in-between; 3=very close) |
sn_relate_cd | 9 | 3 | 1 | 3 | relationship of alter c & d (1=strangers; 2=in-between; 3=very close) |
sn_relate_ce | 7 | 3 | 1 | 3 | relationship of alter c & e (1=strangers; 2=in-between; 3=very close) |
sn_relate_de | 7 | 2 | 2 | 3 | relationship of alter d & e (1=strangers; 2=in-between; 3=very close) |
Comment