nwstack

Stack several networks into one block-diagonal network

Syntax

nwstack
netlist,
name(newnetname)
[gr:oup(newvar)
replace]
   
name(newnetname) name of the stacked network (required)
gr:oup(newvar) variable that numbers the networks of netlist 1, 2, … for the nodes of each
replace replace an existing network of that name

Description

nwstack places the networks of netlist side by side in one network. The nodes of the first network come first, then those of the second, and so on; there are no ties between nodes of different networks, so the result is the block-diagonal matrix of the networks. This is the data structure that nwsaom uses for several groups (its option groups()), where each group is a separate set of actors, such as a school class, observed with the same instrument.

The networks must be one-mode and agree in direction. With group() the command creates a variable that holds the position of the network in netlist, for every node of the stacked network. If there are no data in memory, the command creates the observations; if there are data, they must already have one observation per node, in the order of the stacked network.

Stored results

nwstack stores in r(): r(k), the number of networks stacked, and r(N), the number of nodes of the stacked network.


nwcommands version 3.17.6, 9 November 2026 (check your installed version)


Back to top

nwcommands is free software under the GNU General Public License, version 3, as are the model packages nwsaom, nwergm, nwdynam and nwrem. Citing and licenses · Get help · GitHub. Issues with the core go to the nwcommands repository; issues with a model package go to that package's own repository.

This site uses Just the Docs, a documentation theme for Jekyll.