nwcommands
Network analysis in Stata: import, generate, describe, analyze and plot networks, and fit statistical network models, from the Stata command line or from dialog boxes.
Install Tutorials Command reference Which package do I need?
The packages
nwcommands is a family of five packages. The core handles networks (134 commands and 120 dialog boxes). Four model packages build on it. They are installed separately, and each follows an established R package without replacing it. The core and all four model packages are free software under the GNU General Public License, version 3.
| Package | What it does | Follows | Version |
|---|---|---|---|
| nwcommands (core) | Import, generate, describe, analyze and plot networks | 3.12.1 | |
| nwsaom | Stochastic actor-oriented models (SAOM) for network panels (Manual) | R package RSiena | 1.3.4 |
| nwergm | Exponential random graph models (ERGM) for one network (Manual) | R package ergm (statnet) |
1.3.5 |
| nwdynam | Dynamic network actor models (DyNAM) for event data | R package goldfish |
1.2.0 |
| nwrem | Relational event models (REM) for event data | R package relevent |
1.0.10 |
Not sure which one you need? See Which package do I need?.
Install in two steps
. net install nwcommands, from(https://nwcommands.org/net/) replace
. nwinstall, everything
- The first line installs
nwinstallitself and the landing help topics. nwinstall, everythingdownloads everything else: the core (every command, all help files and every dialog box) and the four model packages, sets up the “Network Analysis” menu in Stata’s User menu (one line in yourprofile.do, never written twice), and prints the version of each package at the end. Addnoguito leave the menu out;nwinstall, guiadds it later (the older option namepermanentlystill works).
To install the core only, type nwinstall, all instead of nwinstall, everything; the model packages can be
added later with nwinstall, models (repeating nwinstall, everything or nwinstall, models also updates them). To install one model package only, for example nwsaom, type
net install nwsaom, from(https://raw.githubusercontent.com/thomas-u-grund/nwsaom/main/).
Requirements: Stata 17 or later (tested with Stata 17 and 18; StataBE is enough).
If Stata answers option everything not allowed, an older nwinstall is being used. Type which nwinstall: the
path should point into Stata’s ado/plus folder. If it says ./nwinstall.ado, an old copy lies in the folder
Stata was started from (the current folder is searched first): change to another folder with cd. If an older
copy is loaded in memory (for example by your profile.do), type program drop nwinstall (or restart Stata).
Then run nwinstall, everything again.
nwversion shows the installed versions. More on installation, releases and computers without
internet access: Installation & Setup.
After installing, try this: it loads the Florentine marriage network, plots it, and computes each family’s betweenness centrality.
. nwwebuse florentine, nwclear
. nwplot flomarriage, label(_nwnode)
. nwbetween flomarriage
. sum _between
Where to start
- New to networks in Stata: the tutorials, starting with Installation & Setup and Core Concepts.
- You know the command you want: the command reference.
- Coming from R (RSiena, statnet, goldfish, relevent): nwsaom and RSiena and the “Follows” column above.
- How fast the model packages are compared with R: Speed compared with R (faster in most of our benchmark models, not in all).
- Citing the software, licenses and releases: Citing and licenses.
- Problems: issues with the core go to the nwcommands repository; issues with a model package go to that package’s own repository on GitHub.