Skip to content

Releases: thomas-u-grund/nwergm

nwergm 1.3.5

Choose a tag to compare

@thomas-u-grund thomas-u-grund released this 28 Oct 10:44

Patch release (dialogs only; includes the changes listed under 1.3.4, which was not released separately). The Mata libraries and the plugin are unchanged.

Changed

  • The simulate dialog starts with the choice "Use the model of the last nwergm fit". It is on when the last estimation was nwergm; the command is then nwergm simulate, nsim() ... and all model fields (nodes, terms, theta) are greyed out. Untick it to specify the model yourself.
  • New drop-down "Type" (auto / undirected / directed / two-mode) in the nwergm dialog and "Network type" in the simulate dialog. It is set automatically when a network is chosen. Terms that do not apply to the type are greyed out (never hidden); "auto" switches everything on again.
  • New helper _nwergm_dlgprep.ado fills the network list and the types when a dialog opens (works with core 3.12.1).

Also included (1.3.4):

Not released separately: these changes are part of 1.3.5. The Mata libraries and the plugin are unchanged.

Changed

  • Dialogs (nwergm and nwergm simulate): the geometrically weighted terms are easier to find. gwesp(), gwdsp(), gwnsp(), their decay-estimated versions gwespfree(), gwdspfree(), gwnspfree() and the type() box for directed shared partners moved from the Curved tab to the Triads tab. gwdegree(), gwodegree(), gwidegree() and their decay-estimated versions moved to the Degree tab. The Curved tab is gone because nothing was left on it. The commands the dialogs build are unchanged.
  • Dialogs: the 'Simulate networks...' and 'Postestimation...' buttons gave the Stata message 'Wait until Stata has completed the current command...'. They now queue the db command instead of running it at once, so the related dialog opens.
  • Dialogs: the command built by the dialogs no longer has a blank before a closing bracket (nodecov(wealth) instead of nodecov(wealth )), and the terms are always separated by one blank. With sub-options a blank can remain before the comma.

nwergm 1.3.3

Choose a tag to compare

@thomas-u-grund thomas-u-grund released this 28 Oct 08:57

Patch release. The Mata libraries and the plugin are unchanged.

Changed

  • Dialog box. The main dialog (db nwergm) has two buttons on its first tab, "Simulate networks..." and "Postestimation and goodness of fit...", that open the matching dialogs. The commands the dialogs build are unchanged.

nwergm 1.3.2

Choose a tag to compare

@thomas-u-grund thomas-u-grund released this 27 Oct 17:15

Changed

  • README: the manual is on Zenodo; the all-versions address is https://doi.org/10.5281/zenodo.23661331. Cite the manual by that address together with the package version printed by nwergm version.
  • Development script dev/ergm_benchmark_usair/01_prep_network.do no longer reaches into the internal network registry of the core package (its name changes between core versions). It reads the network with nwtomata; the exported edge list is identical to the earlier one. No change to the package itself (same code and plugins as 1.3.1; core 3.6.0 or later).

nwergm 1.3.1

Choose a tag to compare

@thomas-u-grund thomas-u-grund released this 26 Oct 18:33

Fixed

  • quietly estat mcmcdiag printed the row of a statistic flagged by Geweke's test (and the FAILED row of the Heidelberger-Welch table and the warning about a fit that did not converge), because those lines were written in the error colour, which quietly does not silence. It now prints nothing.
  • estat mcmcdiag printed the requested thinning interval (for example 1024) although the final sample was recorded at the interval the adaptive sampler arrived at, e(mcmc_interval_final) (for example 4096; 6400 with mcmcinterval(50)). The header now shows the interval of the final sample, as the report of R's mcmc.diagnostics() does, and a second line names the requested interval when the two differ. The autocorrelation lags of the report were already computed from the interval of the final sample.
  • The closing note of estat mcmcdiag advised raising mcmcsamplesize(). It now advises raising mcmleeffectivesize() (the target effective sample size of the adaptive default) and, for fits with fixed-size samples (mcmleeffectivesize(0)), mcmcsamplesize() or mcmcinterval().
  • README: the section on the MCMC defaults describes the adaptive sample of 1.3 (base size max(256, 32 p), target effective sample size 64, interval halved from one iteration to the next; mcmleeffectivesize(0) is the algorithm of 1.2.3) and the install-by-tag example uses v1.3.1. The hint next to mcmcsamplesize() in the dialog no longer says "default 3000".

Corrected

  • The notes of 1.3.0 said "2.4 to 7.7 times faster than R; 1.2.3 slower on seven of the eight" benchmark models. Re-measured on an idle machine (median of seven interleaved fits): nwergm 1.3.0 is 2.9 to 9.4 times faster than R's ergm 4.12.0, and 1.2.3 is slower than R on six of the eight models, about equal on one and faster on one (details: the benchmark section of the manual). The 1.3.0 section below is left as it was published.

Changed

Changed

  • Manual brought to the 1.3 series ("Manual for version 1.3", manual/nwergm_manual.pdf, 104 pages): it now describes the sampling of 1.3.0 (adaptive sample size, mcmleeffectivesize() and its interplay with mcmcsamplesize(), mcmcburnin() and mcmcinterval(), R's convergence test, covariance and bridge from the fit's own sample), the speed comparison with R (eight benchmark models), and the new correspondences in the translation table. Every listing, comparison table and run-time table was regenerated with nwergm 1.3.0 and nwcommands 3.10.0 (ergm 4.12.0 for the comparisons); manual/ZENODO.md carries the metadata of the Zenodo record for the series 1.3.
  • Test test_nwergm_estat checks that quietly estat mcmcdiag prints nothing, that the printed interval equals e(mcmc_interval_final) and the end note.

nwergm 1.3.0

Choose a tag to compare

@thomas-u-grund thomas-u-grund released this 26 Oct 14:53

Results that change (read before you re-run old analyses)

  • The MCMLE sample size is adaptive, as in R's ergm. Each MCMLE iteration now draws a base sample of max(256, 32 times the number of parameters) and keeps sampling until the effective sample size of the estimating equations reaches 64 (mcmleeffectivesize(), R's MCMLE.effectiveSize), discarding a burn-in estimated from the sample itself and thinning the chain by two whenever the sample has doubled; the next iteration starts from half the interval that was needed (R: MCMLE.effectiveSize.interval_drop). Before, every iteration recorded exactly 3,000 draws at the full interval and the interval was enlarged when the effective size was below max(200, 64 p). The coefficients of a fit are therefore different draws from the same distribution: the mean of 20 fits agrees with the mean of 20 R fits within 0.04 standard errors on five models (Florentine, Lazega, Mesa, and two simulated networks), the reported standard errors agree within 3%, and the estimates scatter between seeds like R's (the effective sample size of the final sample is about 64 or more, not several hundred). e(mcmc_samplesize) is the number of draws actually kept. The old behaviour is mcmleeffectivesize(0) (fixed 3,000 draws, mcmcsamplesize() to change it); the sample size given in mcmcsamplesize() is the base size of the adaptive sample.
  • The default convergence test is R's. With the adaptive sample the fit stops when, with 99% confidence, the estimating equations at the updated coefficients lie inside R's tolerance region (MCMLE.MCMC.precision = 0.1; MCMLE.termination="confidence"); a test that fails raises the target effective size and the base sample size by the factor R uses (at most 2, sample size with the square root of the factor). The earlier test (a Hotelling test that the mean estimating equation is zero) accepted small samples too easily: with an effective size of 64 it stopped after one iteration with coefficients that scattered 2 to 4 times more between seeds than R's. Fits with mcmleeffectivesize(0) keep the earlier test. The number of iterations is now like R's (Lazega advice 4 to 12, R 6 to 8).
  • The covariance matrix of a converged fit is computed from the sample of the last MCMLE iteration, as in R, instead of from one further sample at the final point (a further sample is drawn only when the iterations ran out before convergence).
  • The log-likelihood by bridge sampling uses, as in R, the sample size, the interval and the burn-in of the fit's own last iteration (16 bridges, about 300 draws each) instead of 3,000 draws per bridge; its Monte Carlo standard error e(ll_se) is somewhat larger.
  • The starting values of large models (more than 20,000 dyads) differ in the ninth digit or later: the pseudolikelihood is maximized by the built-in iteration instead of falling back to Stata's logit (the likelihood-decrease check was an absolute 1e-9, which rounding errors exceed when the log-likelihood is in the tens of thousands).

Changed

  • Speed. On the eight benchmark models of the article (median of seven interleaved fits on an idle machine, same networks and defaults) nwergm is now 2.9 to 9.4 times faster than R's ergm 4.12.0; 1.2.3 was slower than R on six of the eight, about equal on one and faster on one. (This corrects the first version of these notes, which gave 2.4 to 7.7 and seven of the eight from a first, busier measurement.) The main reason was the sample size policy above; in addition the C kernels are faster per proposal than before (adjacency bit matrix instead of hash lookups, tabulated GW kernel, constant-time uniform dyad draw), the frame handed to the plugin is sized to the network (not to the number of dyads), consecutive native runs hand the network on as a tie list (Mata rebuilds its graph once per fit, not after every run), the full statistics are carried from run to run, and the MPLE and dyad-independent likelihoods of large models are computed on the distinct rows of the design matrix.
  • New option mcmleeffectivesize(#) (default 64; 0 = fixed-size samples) is now documented and drives the adaptive sample.

Fixed

  • Nothing in the estimates changes when mcmleeffectivesize(0) is given with explicit sample sizes: the statistics, the estimates and the log-likelihood of such a fit are identical to 1.2.3 (up to the starting values of large models noted above).

Added

  • Manual brought to the 1.2 series ("Manual for version 1.2", manual/nwergm_manual.pdf, LaTeX source in manual/): the model and the estimators, the complete syntax, the reference of the terms (generated from the term inventory by manual/build_terms.py), diagnostics and goodness of fit, worked examples with real output, the validation against ergm 4.12.0, the limits, and a translation table from R's ergm. Every listing, comparison table and run-time table was regenerated with nwergm 1.2.3 and nwcommands 3.9.1 (ergm 4.12.0 for the comparisons). The do-files that produce every listing are in manual/ex; manual/run_examples.sh reruns them. The manual states the 1.2.x behaviour: the defaults of the Markov chain follow R's control.ergm, a valued network is fitted as the binary graph, edgecov() with a two-mode network, the installation with nwinstall.

nwergm 1.2.4

Choose a tag to compare

@thomas-u-grund thomas-u-grund released this 26 Oct 09:56

Patch release. Works with nwcommands 3.6.0 and later; no change of the Mata library.

Changed

  • Help text corrected: the description no longer says that the package is a fully native Stata/Mata implementation or that Mata is always the reference (the sampler, the change statistics and the pseudolikelihood design matrix run in the compiled plugin; the Mata implementation is a slow fallback for tests and comparison); valued networks are described as fitted to the binary graph with one note (not rejected); the speed ratios of an earlier benchmark are removed (speed relative to R depends on the model); Windows and Linux plugins are described as built by the continuous-integration workflow; the page range of Geyer and Thompson (1992) is 657-683; the provenance line says that the package was developed from ergm and is distributed under the GPL-3; the README install lines start with nwinstall. No change in code or results; the Mata library is unchanged.

nwergm 1.2.3

Choose a tag to compare

@thomas-u-grund thomas-u-grund released this 26 Oct 04:59

Patch release. Works with nwcommands 3.6.0 and later; no change of the Mata library.

Results that change (read before you re-run old analyses)

  • A valued network is now fitted as the binary graph, with one note. With nwcommands 3.6.0 a network made with a value variable is flagged valued (also when every value is 1), and nwergm refused every valued network. It now fits the graph in which a tie is present when its value is not zero, as R's ergm does without response=; one note says that the tie values are ignored (no note when every value is 1). Fits of networks that are not flagged valued are unchanged.

Fixed

  • edgecov() with a two-mode covariate network on a two-mode model stopped with "has missing dyads" (the node-by-node matrix of a two-mode network is missing between nodes of the same mode); only the cells between the modes are read.
  • A network whose ties are all 1 is accepted (it was refused as valued).

nwergm 1.2.2

Choose a tag to compare

@thomas-u-grund thomas-u-grund released this 25 Oct 23:21

Changed

  • Rebuilt for nwcommands (core) 3.6.0: the Mata library is compiled against the core library of 3.6.0 (built with Stata 17) and the package needs nwcommands 3.6.0 or later. No change in results.
  • Install lines and the README: nwinstall, everything installs the core and the four model packages in one step. Supported Stata versions: 17 or later, tested with Stata 17 and 18.

nwergm 1.2.1

Choose a tag to compare

@thomas-u-grund thomas-u-grund released this 25 Oct 21:04

Fixed: the Mata libraries of the previous release, built with Stata 18, were ignored by Stata 17 (r(3499)). They are now built with Stata 17, which works in Stata 17 and 18. Requires nwergm 3.5.1 or later. Stata 17 or later, tested with 17 and 18. No change to results.

If you have an older install, run ado uninstall nwergm and ado uninstall nwergm first, then reinstall as on https://nwcommands.org/nwergm/install/.

nwergm 1.2.0

Choose a tag to compare

@thomas-u-grund thomas-u-grund released this 25 Oct 17:52

Results that change (read before you re-run old fits)

  • The default MCMC settings are those of R's ergm: mcmcinterval() 1024 (was 50) and mcmcburnin() 16384 (was 3000). A fit that used the defaults gives different numbers than in 1.1.x (same seed, different chain, better mixing); fits that gave both options explicitly are unchanged.

Changed (results change!)

  • The default MCMC settings are now those of R's ergm 4.12.0. mcmcinterval() defaults to 1024 (was 50; R: MCMLE.interval) and mcmcburnin() to 16 times the interval, 16384 (was 3000; R: MCMLE.burnin = MCMLE.interval * 16), at every MCMLE iteration. An mcmcinterval() given without mcmcburnin() now also sets the burn-in to 16 times its value, as in R; before, the burn-in stayed at 3000. The same new defaults apply to nwergm simulate (R: control.simulate: interval 1024, burn-in 16 times the interval). Explicit mcmcburnin() and mcmcinterval() are used as given.
  • Why: with an interval of 50 the chain of a dyad-dependent fit was strongly autocorrelated. On the Lazega advice model with mutual the effective sample size of the final sample was 21 to 29 out of 3000 draws (R: 246 to 308); with the new defaults it is 340 to 410. On the Mesa model with gwesp(.25) it rose from 10 to 20 to 321 to 367 (R: 158 to 184). Coefficients now agree with R within Monte Carlo error; with the old defaults single fits were off by up to two thirds of a standard error (Mesa race match 0.21 against R 0.29, se 0.12). The price is run time: a fit takes about 2 to 30 times longer than before (Lazega with gwesp(.5) 6 s to 20 s, Mesa 0.4 s to 13 s; R: 17 s and 4 s). The old settings are reachable with mcmcburnin(3000) mcmcinterval(50).
  • Fits that used the defaults give different numbers than in 1.1.x (same seed, different chain). Fits that gave both options explicitly are unchanged. Results printed in the manual, the help examples and the book for default-setting fits must be regenerated.
  • Help file, dialogs (the hints next to mcmcburnin() and mcmcinterval()) and README state the new defaults; the help of estat gof quotes the right values for fits by pseudolikelihood. Test test_nwergm_rdefaults checks that the documented defaults are what runs.
  • Not changed, on purpose: mcmcsamplesize() stays 3000 recorded draws (R adapts the number of draws to an effective size of 64, with at least 256 draws), and the adaptive interval and sample growth keep their floor of max(200, 64 times the number of parameters) effective draws, which is stricter than R's 64.