*! version 1.0 23 May 2014
help for d3networkversion 1.0 (23 May 2014)

Title

d3network -- Create network visualizations using D3.js to view in browser

Table of contents

Syntax
Description
Options
Remarks
Example
References
Authors

Syntax

d3network [using directory], options

Obligatory
network(varlist) variables spanning network

id(variable) nodes' unique identifier

distinction(varlist) nesting of networks (i.e., networks' unique identifier(s))

nodecov(varlist) nodal attributes

Optional
nodecov_newnames(string) use new names instead of cryptic variable names

arrows draws directional links

replace overwrite existing network data

Description

d3network provides a very convenient way to quickly generate multiple directed network graphs. These graphs can be explored
interactively in the browser according to user-chosen nodal attributes. This interaction pertains to changes in nodes' size,
color, links' color, and nodal position via drag-and-drop. The visualization of networks is based on the JavaScript library D3.js (Bostock et al. 2011).

Technically, d3network converts network data from a stata dataset in wide-format to json-format
and generates a html file entailing the visualization. Compared to other network visualization software,
d3network's strength is the batch generation of multiple networks that can quickly be browsed through.
The generated .html and .json files are either saved to the working directory or to the directory specified by using.

Options

Obligatory

network(varlist) denotes the variables that span the network. For example, in a school-based survey this could be five variables reflecting students' five best friends within their class.

id(variable) indicates the variable that uniquely identifies each sending node.

distinction(varlist) clarifies the distinction between multiple networks within one dataset. For example, in a school-based survey
this could be schools (id_school) as level 1, grades as level 2 (id_grade), and classes as level 3 (id_class).

nodecov(varlist) provides the list of nodal attributes to be inspected in the visualizations.

Optional

nodecov_newnames(string) renames the attributes provided in nodecov(varlist).

arrows provides a visual clarification of link-direction between nodes by adding arrows denoting ingoing links.

replace permits d3network to overwrite previously generated networks.

Remarks

d3network deals with missing information in the following way. In case of unit nonresponse, links to the unit (i.e., node) are deleted by default.
If incoming links shall be visualized, the dataset has to be prepared accordingly. Item nonresponse has to be met by assigning arbitrary values. As a matter
of visualization, these values should tie to the value range of the pertaining item.

Outgoing links from a node to the node itself (i.e., loops) are not considered.

The testing environment included Firefox Version 27.0.1 (as well as 29.0.1) running on Windows 7 SP1.

Example

Generating class-level networks from a school-based survey:
The variables id_school, id_grade, and id_class represent our distinction between class-level networks.
The variable id_student uniquely identifies each student. The variables friend1-friend5 reflect the links, i.e. the friendship nominations, and the ids entailed in those nominations correspond to those of the id variable.
The attributes we want to look at are sex and ethnicity, which are entailed in the variables p42c8 and g53z2. As the variable names are very cryptic we want to rename them. In total, we have surveyed 50 classes.
Thus, we can quickly browse through 50 distinct networks, change nodes' visualizations (i.e., color and size) according to their attributes sex and ethnicity, and fix nodes' positions within the graph via drag-and-drop.

. d3network, distinction(id_school id_grade id_class) id(id_student) network(friend1-friend5) nodecov(p42c8 g53z2) nodecov_newnames(sex ethnicity)

References

Bostock, M., Ogievetsky, V., & Heer, J. (2011). D3: Data-Driven Documents. IEEE Trans. Visualization & Comp. Graphics (Proc. InfoVis).
Available at http://vis.stanford.edu/files/2011-D3-InfoVis.pdf

Acknowledgements

This routine draws heavily on the work of Michael Bostock and his colleagues. More information on D3.js can be found at http://www.d3js.org.

We thank Harald Beier, Hanno Kruse, and Lars Leszczensky for their comments and suggestions.

Authors

Sebastian Pink and Sabrina Vogel, University of Mannheim, Germany.