Repository navigation
Releases
nwlsm 1.0.6
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
estat mcmcdiagprinted 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 ofnwlsmno longer prints a posterior mean log likelihood of -10000 or below in scientific notation. Testcscripts/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
estat mcmcdiag: the Geweke z is now computed as R does, asgeweke.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 asspectrum0.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)andr(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. Newr(geweke_nexceed)andr(geweke_z)(chains by parameters);r(geweke_max)andr(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(), newlsm_spec0()andLsmGewekeZ(). Testcscripts/test_nwlsm_mcmcdiag.do: values of coda for fixed series, the counts andr(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
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 resultsr(geweke_max),r(geweke_crit),r(geweke_ntests),r(geweke_flag),r(ess_min),r(ess_flag).- Output that wrapped at
linesize 80fits now: the table ofestat mcmcdiag(82 columns before, 74 with the Rhat column, 65 without; the Rhat header printed as "Rh/at"), the acceptance-rate line, the titles ofestat gof,estat ppcheck(and its line of scores),estat clustersandnwlsmselect, and the summary line ofestat bic. - Mata library rebuilt (Stata 17):
lsm_geweke(). Testcscripts/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
[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 fromnwtomatahas), 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. Testcscripts/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
- Dialogs:
nwlsm_estat.dlghas a field for the graph name (name()) of the graphs ofestat mcmcdiag,gof,ppcheckandinfluence;nwlsmselect.dlghas a field for the graph options (gopts()). - The dialog test
tools/dlg_assembly_test.pychecks the command thatnwlsmplot.dlg,nwlsm_estat.dlgandnwlsmselect.dlgbuild;cscripts/test_dlg_plots.doruns 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
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); atitle()orsubtitle()you give is black like the default unless it carries its owncolor();noarrowsis recognised only as an option word (a file name such asexport(x_noarrows.png)or a title text containing "noarrows" is left alone). Tests incscripts/test_nwlsm_plots.do.- Plots (
nwlsmplot,nwlsmselect, graph, the graphs ofestat): 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 ofcolor()shows the value labels of the variable and its variable label as the legend title;noarrowsworks now (Stata read it as the negation ofarrows; 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, orgray: gray values and filled/hollow marker symbols for black-and-white print). Tests incscripts/test_nwlsm_plots.do. nwlsmplot:labposition()acceptsauto, 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 numericlabposition()works as before (test_nwlsm_plots).nwlsmplotdraws 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 ofcirclesare round and distances are undistorted.noequalrestores the square plot region with independent axis ranges. Test intest_nwlsm_plots.- First stable release: the syntax, the stored results and the options are kept from here on within 1.x.
nwlsmplot: new optionsarrows/noarrows(ties of directed networks as arrows from sender to receiver, the default for directed networks; shortened to the border of the marker),clustermeansandcircles(posterior mean cluster means and circles with the square root of the posterior mean cluster variance as radius, asplot.meansandplot.varsof latentnet'splot.ergmm(); fits withclusters()),certainty(withclusters: 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 againste(Zmean)),labsize(),labposition(),noaxes,export(filename [, options])(graph export;saving()works as a twoway option). Cluster colours ofclustersnow 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 innwlsm.dlg, asnwlsm_estat.dlgandnwlsmplot.dlg; the package has one menu entry in the core); the new options innwlsmplot.dlg;nwlsmselect.dlginnwlsm.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 (seecertainty), 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
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
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.