Skip to content

nwcommands 3.20.0

Choose a tag to compare

@thomas-u-grund thomas-u-grund released this 12 Nov 10:42
· 690 commits to main since this release

Added

  • nwplot ..., basemap() draws outlines, such as the borders of a map, under a network whose nodes are placed with nodexy(), for example by longitude and latitude. The argument is a Stata file with the coordinates in _X and _Y (the *_shp.dta file that spshape2dta makes from a shapefile), a web address, or the name of a map among the example data; line options follow after a comma, and if keeps part of the map (basemap(usmap if !inlist(state, "AK", "HI")) for the lower 48 states). The picture then takes the proportions of the map unless aspectratio() is given; for longitude and latitude, a degree of longitude is narrowed to its width at the middle latitude of the map (cosine), so that a country keeps its familiar shape. New example file usmap (outlines of the US states, US Census Bureau, public domain): nwplot usair, nodexy(Lon Lat) basemap(usmap).
  • Save do-file on the interactive page of nwplot. A new button saves nwedit_plot.do, which redraws the picture in Stata as it is on the page: it writes the two files of Save nodes and Save edges into the working directory and calls nwplot with the network, if/in and options of the call that wrote the page, completed with nodexy(), importcoords() and edgeimport(). Run it with run nwedit_plot.do.
  • Group names in nwplotmatrix, group(). The name of each group (its value label, or the string; a numeric variable without a value label gets none) is written beside its block, at the top and at the left, and the lines between the groups are drawn medium thick, so that one can see where a group starts and ends. nogrouplabels leaves the names out; with node labels (lab, label()) the names are not written.
  • nwdyads, plot and a new nwtriads, plot. Both draw the census as small pictures of the dyad (or triad) types, each with its MAN code and its count underneath, in the order of the printed table; on an undirected network only the types an undirected network can have. The bar chart that nwtriads, plot drew before is replaced. New test test_census_plot.
  • nwsummarize reports the mean degree (mean outdegree of a directed network) under the density, and stores it in r(meandegree).
  • nwgeodesic on a network with unconnected pairs now also prints, and stores, the share of pairs that are connected and the average and longest distance over the connected pairs (r(connected), r(avgpath_connected), r(diameter_connected)). The overall average, diameter and radius are still "(not defined)" and r(avgpath) is still -1.

Changed

  • Data set lazega has three more variables: officenum (1 Boston, 2 Hartford, 3 Providence), practicenum (1 corporate, 2 litigation) and partner (1 partner, 0 associate), the office, practice and status as numbers with value labels, for commands that need numeric groups (group(), nodematch(), nwqap). The string variables and the networks are unchanged.
  • nwgeodesic overwrites its default output network _geodesic without nwreplace, as nwreach does with _reach. A network named with name() is still protected.
  • The help of nwplot says that the PNG export of the interactive page is a raster image, and that nodexy() also draws layouts computed elsewhere.