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
netexamplenetexp— Network expression and functionnetlistnetnamenewnetnamenodeid
Import/Export
nw2fromedge— Import two-mode network data from edgelistnw2set— Declare data to be two-mode network datanw2toedge— Convert two-mode network to edgelistnwappend— Append network datasetnwexport— Export network as Pajek or Ucinet filenwfromedge— Imports network data from edgelistnwimport— Import networknwsave— Save network data in filenwset— Declare data to be network datanwtoedge— Convert network to edgelistnwuse— Load Stata network datasetnwwebuse— Load network data over the web
Generators
nwbridges— Calculate bridgesnwdissimilar— Generate node dissimilaritiesnwduplicate— Duplicate a networknwdyadprob— Generate a network based on tie probabilitiesnwexpand— Expand variable to networknwgen— Network extensions to generatenwgenerate— Network extensions to generatenwgenvar— Network extensions to generatenwgeodesic— Calculate shortest paths between nodesnwhomophily— Generate a homophily networknwlattice— Generate a lattice networknwpath— Calculate paths between nodesnwpermute— Generate permutation of a networknwpref— Generate a preferential-attachment networknwrandom— Generate a random networknwreach— Calculate reachability networknwring— Generate a ring-lattice networknwsimilar— Generate node similaritiesnwsmall— Generate a small-world networknwstack— Stack several networks into one block-diagonal networknwsubset— Subset the nodes of a networknwtranspose— Transpose a network
Information
nwcurrent— Report and set current networknwdyads— Dyad censusnwissymmetric— Check if 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 the 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 threshold (built on nwrecode)nwdrop— Drop networks or network nodesnwdropnodes— Drop nodes from a networknwkeep— Keep a network (or only certain nodes)nwkeepnodes— Keep nodes of a networknwname— Obtain and change meta-information 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 networknwrename— Rename a networknwreplace— Replace 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 networknwsymmetrize— Symmetrize network (alias for nwsym)nwtranspose— Transpose a network
Analysis
Centrality
nw2degree— Two-mode (bipartite) degree centralitynwbetween— Calculate betweenness centralitynwcentrality— Node centrality measuresnwcloseness— Calculate closeness centralitynwdegree— Degree centrality and distributionnwevcent— Calculate eigenvector centralitynwinduced— Induced, endogenous and exogenous centralitynwkatz— Calculate a Katz-inspired distance-decay centralitynwpagerank— PageRank centrality
Cohesion, Components & Subgroups
nw2motifs— Bipartite motifs of a two-mode networknw2nested— Nestedness (NODF, C-score) of a two-mode networknwbridges— Calculate bridgesnwclique— Maximal clique enumerationnwcomponents— Calculate network components / largest componentnwkcomponents— Maximal k-component enumerationnwkcore— k-core decompositionnwkplex— Maximal k-plex enumerationnwnclan— Maximal n-clan enumerationnwnclique— Maximal n-clique enumerationnwsimmelian— Calculate Simmelian ties
Community Detection
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 & Equivalence
nw2clustering— Clustering coefficient (transitivity) of a two-mode networknwassortativity— Newman’s assortativity coefficientnwbalance— Structural balance of a signed networknwbrokerage— Gould-Fernandez brokerage rolesnwburt— Calculate Burt structural hole measuresnwclustering— Clustering coefficient (transitivity) of a networknwconcor— CONCOR structural-equivalence blockmodelnwconstraint— Calculate 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)nwlambda— Edge (line) connectivity matrix between all node pairsnwmatching— Maximum-cardinality bipartite matchingnwmixing— E-I index and mixing table for a categorical node attributenwshared— Calculate number of shared neighbors between nodes and saves information in networknwsimilar— Generate node similaritiesnwsimindex— Common-neighbor similarity indices between all node pairs
Paths, Reachability & Ego Networks
nwaltergen— Generate a variable from alter/neighbor attributesnwego— Ego-network size and densitynwgeodesic— Calculate shortest paths between nodesnwmaxflow— Maximum flow and minimum cut between two nodesnwneighbor— Extract the network neighbors of a nodenwpath— Calculate paths between nodesnwrandomwalk— Mean random-walk hitting time to a target nodenwreach— Calculate reachability network
Statistical Estimation of Networks (core)
nwcorrelate— Correlate networks and variablesnwcug— Conditional Uniform Graph (CUG) testnwqap— Multivariate QAP regressionnwutility— Calculate utility scores according to Jackson and Wollinsky (1996)
Other Analysis Utilities
nwcontext— Create a context variablenwgen— Network extensions to generatenwgenerate— Network extensions to generatenwgenvar— Network extensions to generatenwnode— Checks if node exists in a networknwturnover— Tie turnover/stability between two waves of the same networknwvalue— Returns a tie value
Utility Commands
nwds— List loaded networks, in the style of Stata’s ownds
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— What this package’s own custom return codes meannwinstall— Install Stata menu/dialogsnwload— Load a network as Stata variablesnwnetworktypes— How commands classify binary/directed/weighted/signed/two-mode networksnworder— Reorder networks in datasetnwsync— Sync network with Stata variablesnwtomata— Return adjacency matrix of networknwtomatafast— Return link to adjacency matrix of networknwtostata— Copy a Mata matrix into Stata variablesnwunab— Unabbreviate network listnwvalidate— Validate network namenwvalidvars— Validate Stata variables for network
Visualization
nwdendrogram— 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— Compresses observations in Stata