Skip to content

Releases

nwlsm 1.0.6

Choose a tag to compare

@thomas-u-grund thomas-u-grund released this 22 Nov 15:58

nwlsm 1.0.6

Fixed

  • Heap overflow in the optimiser (mkl_lbfgs) for networks with fewer than 10 position coordinates (3 to 6 actors). It could crash Stata (0xC0000374 on Windows) and may corrupt memory elsewhere. Windows users who saw crashes on very small networks should update. Results for networks that did not crash are unchanged. The plugins of all platforms are rebuilt from the fixed source. New test cscripts/test_nwlsm_small.do.

Changed

  • The default number of threads (threads(0)) is now 4 threads for one chain and 2 threads per chain for several chains, at most one per processor core. Estimates are identical for every number of threads. A single chain with 200 or more actors is faster on computers with many logical cores (Windows: 47.6 to 31.3 s at 200 actors, 154 to 125-133 s at 400 actors); no change measured on macOS and Linux.

Added

  • A network with no ties, or with every possible tie, prints a warning that the data carry no information on the intercept and its estimate is determined by the prior. New stored result e(degenerate) (1 or 0). Estimates and error codes unchanged.

Install: net install nwlsm, from(https://raw.githubusercontent.com/thomas-u-grund/nwlsm/v1.0.6/) replace

nwlsm 1.0.5

Choose a tag to compare

@thomas-u-grund thomas-u-grund released this 21 Nov 06:55
  • estat mcmcdiag printed means below -999.9999 (for example the log-likelihood) in scientific notation (-1.55e+03) since 1.0.3: fixed. The Mean and Sd columns now choose the number of decimals per value so that it fits the 9-character column (-1551.82); the table width is unchanged and all other cells are as before. The summary line of nwlsm no longer prints a posterior mean log likelihood of -10000 or below in scientific notation. Test cscripts/test_nwlsm_mcmcdiag.do (loglik row at 1, 4 and 8 chains).

Tested on macOS with Stata 17 BE: the six nwlsm tests test_nwlsm_mcmcdiag (with the new check for no scientific notation), test_nwlsm_plots, test_nwlsm_errors, test_dlg_plots, test_nwlsm_edgecov and test_nwlsm_post. On Linux (Ubuntu 22.04) and Windows 11 (both StataNow 19.5 MP): the same six tests and a by-hand check of estat mcmcdiag. Stata 18 not run.

nwlsm 1.0.4

Choose a tag to compare

@thomas-u-grund thomas-u-grund released this 21 Nov 06:38
  • estat mcmcdiag: the Geweke z is now computed as R does, as geweke.diag(x, frac1 = 0.1, frac2 = 0.5) of the package coda: z = (mean1 - mean2) / sqrt(s1/n1 + s2/n2) for the first 10 percent and the last 50 percent of the draws of a chain, with the spectral density at frequency zero of each part estimated as spectrum0.ar() does (autoregression by the Yule-Walker equations, order by AIC up to 10 log10(n), s = innovation variance / (1 - sum of the coefficients)^2). The printed z values change (1.0.3 used the autocorrelation time of the whole chain for both parts). Agreement with coda 0.19-4.1: 1e-10 or better on the chains of a four-chain fit and on simulated series.
  • The Geweke z now equals coda::geweke.diag(). The flag and the verdict line of 1.0.3 are removed (r(geweke_flag) and r(geweke_crit) no longer exist; the Bonferroni limit is gone too) because the 1.96 limit is not a 5 percent test with several chains: in settled runs about 16 to 26 percent of the z values exceed it (48 settled fits with 4 and 8 chains; with one chain of 4000 draws 5 of 48), since the first 10 percent of a short chain are a few dozen draws and the autoregressive spectral density of such a part is noisy. The Geweke z is informational only: the footnote counts the z values above 1.96 of the k (parameters times chains), says that about 0.05 k are expected with long settled chains and more with short ones, and tells the user to read z with the trace plots and the effective sample sizes. New r(geweke_nexceed) and r(geweke_z) (chains by parameters); r(geweke_max) and r(geweke_ntests) as before. The table shows the z of largest size over the chains per row; with 2 to 8 chains a second table shows the z of every chain, as R prints it. A z is missing (coda: NaN) for a series that does not move and is left out of the counts. The warning for an effective sample size below 100 stays.
  • Mata library rebuilt (Stata 17): lsm_geweke(), new lsm_spec0() and LsmGewekeZ(). Test cscripts/test_nwlsm_mcmcdiag.do: values of coda for fixed series, the counts and r(geweke_z), a binomial band for one chain, no wrapped output at linesize 80.

Tested on macOS with Stata 17 BE: test_nwlsm_mcmcdiag (new), test_nwlsm_plots, test_nwlsm_errors, test_dlg_plots, test_nwlsm_edgecov and the dialog assembly test (12 of 12 cases). On Linux (Ubuntu 22.04) and Windows 11 (both StataNow 19.5 MP): the same tests (the dialog assembly test needs a GUI Stata and was run on the Mac only) and a by-hand check of estat mcmcdiag. Stata 18 not run.

nwlsm 1.0.3

Choose a tag to compare

@thomas-u-grund thomas-u-grund released this 20 Nov 22:13
  • estat mcmcdiag: the Geweke warning no longer raises false alarms with several chains. The printed z of a row is still the one of largest size over the chains; the warning compares the largest |z| of all rows with the two-sided 5 percent normal quantile with Bonferroni correction for the number of z values (parameters times chains, for example 2.87 for 3 parameters and 4 chains) instead of 2, and a warning is shown when the smallest effective sample size is below 100. The variance of the two segment means of the z uses the autocorrelation time of the whole chain (the effective sample size of a short first segment was estimated too high, so z was too large in settled multi-chain runs). New stored results r(geweke_max), r(geweke_crit), r(geweke_ntests), r(geweke_flag), r(ess_min), r(ess_flag).
  • Output that wrapped at linesize 80 fits now: the table of estat mcmcdiag (82 columns before, 74 with the Rhat column, 65 without; the Rhat header printed as "Rh/at"), the acceptance-rate line, the titles of estat gof, estat ppcheck (and its line of scores), estat clusters and nwlsmselect, and the summary line of estat bic.
  • Mata library rebuilt (Stata 17): lsm_geweke(). Test cscripts/test_nwlsm_mcmcdiag.do (converged runs with 1, 4 and 8 chains are not flagged, a short run is, no wrapped output at linesize 80).

Tested on macOS with Stata 17 BE: the tests of the package including the new test_nwlsm_mcmcdiag and the dialog assembly test. On Linux (Ubuntu 22.04) and Windows 11 (both StataNow 19.5 MP): all test files pass. Stata 18 not run.

nwlsm 1.0.2

Choose a tag to compare

@thomas-u-grund thomas-u-grund released this 20 Nov 14:07

[1.0.2] - 2026-11-20

  • edgecov() with a network, or with a matrix that has a missing diagonal (as the matrix of a network from nwtomata has), no longer stops with "edge covariates must not have missing values" (r(416)): the diagonal of a one-mode matrix is not a dyad and is ignored (set to 0); missing values off the diagonal are still an error. Test cscripts/test_nwlsm_edgecov.do.

Tested on macOS with Stata 17 BE: dialog assembly test (12 cases), test_dlg_plots, test_nwlsm_plots, test_nwlsm_errors, test_nwlsm_edgecov. On Linux (Ubuntu 22.04) and Windows 11 (both StataNow 19.5 MP): test_nwlsm_edgecov (not skipped: the lazega_fr fit with edgecov(lazega_adv) and a missing diagonal ran with rc 0), test_nwlsm_errors, test_nwlsm_plots and test_dlg_plots pass; the dialog assembly test needs a GUI Stata and was run on the Mac only. Stata 18 on the Mac: not run.

nwlsm 1.0.1

Choose a tag to compare

@thomas-u-grund thomas-u-grund released this 20 Nov 13:37
  • Dialogs: nwlsm_estat.dlg has a field for the graph name (name()) of the graphs of estat mcmcdiag, gof, ppcheck and influence; nwlsmselect.dlg has a field for the graph options (gopts()).
  • The dialog test tools/dlg_assembly_test.py checks the command that nwlsmplot.dlg, nwlsm_estat.dlg and nwlsmselect.dlg build; cscripts/test_dlg_plots.do runs the command lines of the graph options.

Tested on macOS with Stata 17 BE, on Linux (Ubuntu 22.04) and on Windows 11 (both StataNow 19.5 MP): dialog assembly test, test_dlg_plots, test_nwlsm_plots and test_nwlsm_errors. Stata 18 on the Mac: not run.

nwlsm 1.0.0

Choose a tag to compare

@thomas-u-grund thomas-u-grund released this 20 Nov 09:32

First stable release. From 1.0.0 the syntax, the stored results and the options are kept within 1.x.

  • nwlsmplot: color() accepts a string variable (groups in alphabetical order, the strings in the legend); a title() or subtitle() you give is black like the default unless it carries its own color(); noarrows is recognised only as an option word (a file name such as export(x_noarrows.png) or a title text containing "noarrows" is left alone). Tests in cscripts/test_nwlsm_plots.do.
  • Plots (nwlsmplot, nwlsmselect, graph, the graphs of estat): titles, subtitles, axis titles and legend titles are black by default (a twoway option still overrides). nwlsmplot: label() takes a numeric variable too (value labels, else the numbers); the legend of color() shows the value labels of the variable and its variable label as the legend title; noarrows works now (Stata read it as the negation of arrows; it is parsed as an option of its own); arrowsize(); dense networks (more than 400 ties) get lighter tie lines and smaller arrowheads by default; colors() (a colour list, or gray: gray values and filled/hollow marker symbols for black-and-white print). Tests in cscripts/test_nwlsm_plots.do.
  • nwlsmplot: labposition() accepts auto, now the default: each label goes to the clock position around its marker with the fewest other markers and already placed labels under it (up to 150 actors; larger networks use position 1). A numeric labposition() works as before (test_nwlsm_plots).
  • nwlsmplot draws with equal scale on both axes by default (one unit equally long on x and y; the range covers points, edges, draws, circles and cluster means with the same padding, aspectratio() follows the ranges), so that the variance circles of circles are round and distances are undistorted. noequal restores the square plot region with independent axis ranges. Test in test_nwlsm_plots.
  • First stable release: the syntax, the stored results and the options are kept from here on within 1.x.
  • nwlsmplot: new options arrows / noarrows (ties of directed networks as arrows from sender to receiver, the default for directed networks; shortened to the border of the marker), clustermeans and circles (posterior mean cluster means and circles with the square root of the posterior mean cluster variance as radius, as plot.means and plot.vars of latentnet's plot.ergmm(); fits with clusters()), certainty (with clusters: opacity of the markers by the largest posterior membership probability, four steps), draws(#) (a faint cloud of # evenly spaced posterior draws of the positions, centred and rotated or reflected to the minimum Kullback-Leibler positions; needs the draws still in memory from the last fit, checked against e(Zmean)), labsize(), labposition(), noaxes, export(filename [, options]) (graph export; saving() works as a twoway option). Cluster colours of clusters now follow the cluster number.
  • nwlsmselect: graph, gname(), gopts() plot the BIC and its parts (ties, positions, random effects) against the number of clusters.
  • Dialogs: new nwlsmselect.dlg (opened from a button in nwlsm.dlg, as nwlsm_estat.dlg and nwlsmplot.dlg; the package has one menu entry in the core); the new options in nwlsmplot.dlg; nwlsmselect.dlg in nwlsm.pkg.
  • Mata library rebuilt (Stata 17): LsmPlotDraws(), LsmPlotDrawStore(); LsmPlotPrep() takes an optional argument for the arrow shortening.
  • Not added, compared with plot.ergmm(): pie markers (see certainty), density plots (what("density")), one-dimensional plots, 3-D plots, Z.ref, zoom.on, cluster.col.
  • Tests: test_nwlsm_plots (every new option on an undirected and a directed fit, graphs exist, error paths, data in memory unchanged).

nwlsm 0.7.0

Choose a tag to compare

@thomas-u-grund thomas-u-grund released this 20 Nov 06:26

BIC (estat bic) and number-of-clusters selection (nwlsmselect) as latentnet's bic.ergmm; estat gof cutoff() for valued networks; persistent worker team for threads; mklstarts() defaults to 4 with sender/receiver/sociality effects. Tested on macOS (Stata 17, 18), Linux (StataNow 19.5) and Windows 11 (StataNow 19.5). See CHANGELOG.md.

nwlsm 0.6.0

Choose a tag to compare

@thomas-u-grund thomas-u-grund released this 19 Nov 21:59

First release of nwlsm: latent space models for networks in Stata (following latentnet 2.12.0), with a native plugin for macOS, Linux and Windows. See CHANGELOG.md.