Command reference
All nwcommands commands, grouped as in help nwtopical.
nwsaom, nwergm, nwdynam and nwrem are not part of the core. They are separate GPL-3
packages with their own sections (see the menu); the entries below only point to them. The
complete syntax is in each package’s own Stata help (help nwsaom etc.).
Concepts
netexample— Example network data setsnetexp— Network expression and functionnetlist— List of existing networksnetname— Name of an existing networknewnetname— Name of a new networknodeid— Identification of nodes
Import/Export
nw2fromedge— Import two-mode network data from an edge listnw2set— Declare data to be two-mode network datanw2toedge— Convert a two-mode network to an edge listnwappend— Append a network datasetnwexport— Export a network as a Pajek, UCINET, GML or edge list filenwfromedge— Import network data from an edge listnwimport— Import a network from a Pajek, UCINET, GML or edge list filenwsave— Save network data in a filenwset— Declare data to be network datanwtoedge— Convert a network to an edge listnwuse— Load a Stata network datasetnwwebuse— Load network data over the web
Generators
nwduplicate— Duplicate a networknwdyadprob— Generate a network based on tie probabilitiesnwexpand— Expand a variable to a networknwgen— Generate variables or networks with network functions (like egen)nwgenerate— Generate a network from a function or a network expressionnwgenvar— Generate variables or networks with network functions (like egen)nwhomophily— Generate a homophily networknwlattice— Generate a lattice networknwpermute— Generate a permutation of a networknwpref— Generate a preferential-attachment networknwrandom— Generate a random networknwring— Generate a ring-lattice networknwsmall— Generate a small-world network
Information
nwds— List the networks in memory (like ds)nwdyads— Dyad censusnwissymmetric— Check whether a network is symmetricnwmotifs— 4-node undirected motif/graphlet censusnwname— Obtain and change meta-information of a networknwsummarize— Summarize a networknwtabulate— One-way table of dyadsnwtriads— Triad census of a network
Manipulation
nw2project— One-mode projection of a two-mode networknwaddnodes— Add nodes to networknwattime— Static graph view of a temporal network at a given timenwcollapse— Collapse a networknwdichotomize— Dichotomize a network at a thresholdnwdrop— Drop networks or nodesnwdropnodes— Drop nodes from a networknwkeep— Keep networks or nodesnwkeepnodes— Keep nodes of a networknwnoderename— Rename a single node in a networknwpreserve— Preserve and restore network datanwproject— One-mode projection of a two-mode network (alias for nw2project)nwrecode— Recode a networknwrename— Rename a networknwreplace— Replace a networknwreplacemat— Replace network with Stata or Mata matrixnwrestore— Restore network data previously preservednwstack— Stack several networks into one block-diagonal networknwsubset— Subset the nodes of a networknwsym— Symmetrize a networknwsymmetrize— Symmetrize a network (alias for nwsym)nwtranspose— Transpose a network
Analysis
Centrality
nw2degree— Two-mode (bipartite) degree centralitynwbetween— Betweenness centralitynwcentrality— Node centrality measuresnwcloseness— Closeness centralitynwdegree— Degree centrality and distributionnwevcent— Eigenvector centralitynwinduced— Induced, endogenous and exogenous centralitynwkatz— Katz-style distance-decay centralitynwpagerank— PageRank centrality
Cohesion, components and subgroups
nwbridges— Find bridges (ties whose removal disconnects the network)nwclique— Maximal clique enumerationnwcohesion— Moody-White structural cohesion hierarchynwcomponents— Network components and the largest componentnwkcomponents— Maximal k-component enumerationnwkcore— k-core decompositionnwkplex— Maximal k-plex enumerationnwnclan— Maximal n-clan enumerationnwnclique— Maximal n-clique enumerationnwsimmelian— Simmelian ties
Communities
nwcommunity— Detect communities via the Louvain method or label propagationnwmodularity— Score an existing node partition using Newman’s modularitynwspectral— Graph Laplacian spectral analysis
Positions, roles and similarity
nwbrokerage— Gould-Fernandez brokerage rolesnwburt— Burt’s structural-hole measuresnwconcor— CONCOR structural-equivalence blockmodelnwconstraint— Burt’s constraintnwcoreperiphery— Discrete core-periphery detectionnwdissimilar— Generate node dissimilaritiesnwfactions— Partition nodes into a specified number of cohesive factionsnwhierarchy— Hierarchical clustering of nodes (role/position analysis)nwshared— Number of shared neighbors of all pairs of nodes, as a networknwsimilar— Generate node similaritiesnwsimindex— Common-neighbor similarity indices between all node pairs
Clustering, mixing and balance
nw2clustering— Clustering coefficient (transitivity) of a two-mode networknw2motifs— Bipartite motifs of a two-mode networknw2nested— Nestedness of a two-mode network: NODF and C-scorenwassortativity— Newman’s assortativity coefficientnwbalance— Structural balance of a signed networknwclustering— Clustering coefficient (transitivity) of a networknwmixing— E-I index and mixing table for a categorical node attribute
Paths, flows and ego networks
nwaltergen— Generate a variable from alter/neighbor attributesnwego— Ego-network size and densitynwgeodesic— Calculate shortest paths between nodesnwlambda— Edge (line) connectivity matrix between all node pairsnwmatching— Maximum-cardinality bipartite matchingnwmaxflow— Maximum flow and minimum cut between two nodesnwneighbor— Extract the network neighbors of a nodenwpath— Paths between nodesnwrandomwalk— Mean random-walk hitting time to a target nodenwreach— Reachability network
Statistical tests
nwcorrelate— Correlate networks and variablesnwcug— Conditional Uniform Graph (CUG) testnwqap— Multivariate QAP regressionnwutility— Utility scores of Jackson and Wolinsky (1996)
Other analysis tools
nwcontext— Create a context variablenwnode— Check whether a node exists in a networknwturnover— Tie turnover/stability between two waves of the same networknwvalue— Return a tie value
Model packages (separate, GPL-3)
nwsaom— Stochastic actor-oriented models (SAOM) for network panels. Section: nwsaomnwergm— Exponential random graph models (ERGM). Section: nwergmnwdynam— Dynamic network actor models (DyNAM) for event data. Section: nwdynamnwrem— Relational event models (REM) for event data. Section: nwrem
Utilities
nwclear— Clear all networks and variables from memorynwcurrent— Report and set current networknwerrorcodes— Return codes of nwcommandsnwinstall— Install the dialogs, menus and the model packagesnwload— Load a network as Stata variablesnwnetworktypes— How commands classify binary/directed/weighted/signed/two-mode networksnworder— Reorder the networks in memorynwversion— Version of nwcommands and of the installed model packages
Visualization
animate— Animate graphsnwdendrogram— Plot a wheel dendrogramnwmovie— Interactive, animated network movie (panel waves or a relational-event timeline)nwmoviexy— Animate a sequence of networks (alias for nwmovie)nwplot— Plot a networknwplotmatrix— Plot a network as sociomatrix
Programming
nwcompressobs— Drop observations that no network needsnwsync— Synchronize a network with Stata variablesnwtomata— Return the adjacency matrix of a networknwtomatafast— Return a link to the adjacency matrix of a networknwtostata— Copy a Mata matrix into Stata variablesnwunab— Unabbreviate network listnwvalidate— Validate a network namenwvalidvars— Validate Stata variables for a network