Skip to content

nwrem 1.6.0

Choose a tag to compare

@thomas-u-grund thomas-u-grund released this 20 Nov 12:45
· 12 commits to main since this release

Added

  • Diagnostics with graphs after nwrem: estat rank, estat actors, estat time (extensions of nwrem; R's relevent has no such methods; help nwrem_estat). estat rank: the rank of the observed sender-receiver pair among all dyads of the risk set by the fitted linear predictor, for every event (mid-ranks for ties); table with mean and median rank, mean percentile rank, the share of top-k hits (observed, expected under the model, and for a model without effects) and the mean log probability of the observed dyad; cumulative curve (default) or histogram of the percentile ranks. estat actors: observed versus expected number of events as sender and as receiver per actor (scatter with the 45 degree line, correlation and Pearson residual sums). estat time: observed versus expected over bins of consecutive events (waiting-time likelihood: events versus integrated rate; ordinal likelihood: top-k hits versus their expected number). Works with both likelihoods, condition(), riskset(), entry()/exit() and the fixed effects.
  • The three subcommands draw by default; noplot shows the table only. Graph options follow the plot convention of the family: name() (default names rank, actors, time; an existing graph is replaced, a trailing , replace is accepted), saving() (.gph), export() (graph export of this graph, replaced, options as in graph export), every other option goes to twoway (histogram, graph combine) and comes last, so it overrides the defaults. Default titles, subtitles and axis titles are black, title("") removes the title, the footnote of estat actors is one short line (it fits a graph 3.6 inches wide), estat actors draws one panel with role(sender) or role(receiver) and has noequal (equal axes and a square panel by default). name(), saving(), export() and graph options with noplot are errors (r(198)); a missing directory is r(603).
  • The graph code uses the shared helper _nw_gfinish of the core; the package now requires nwcommands (core) 3.29.0 or later (nwrem.pkg, README.md). With an older core a graph stops with r(199) and a message before anything is computed; the tables need no helper.
  • The evaluation runs in the native plugin (new code 40; the Mata part is RemDiag()). The protocol number stays 2 on purpose: an older package keeps working with the new plugin, and the diagnostics ask the plugin whether it knows code 40 (code 98); an older plugin stops with r(3495) and a message. Linux and Windows plugins must be rebuilt from native/rem_sim.c before these subcommands work there.
  • e(cmdline) and e(estat_cmd): estat sets the model up again from the stored command line, so the network and the covariate variables must be in memory as at the fit.
  • Tests cscripts/test_nwrem_plots.do (default names, name/saving/export, pass-through last, black titles, title(""), noplot, error paths, data untouched, old core -> r(199)) and cscripts/test_nwrem_estat_oldplugin.do (a plugin built without code 40: the fit works, estat stops with r(3495)).
  • Test cscripts/test_nwrem_estat.do: all quantities against an independent enumeration in Mata (every dyad, statistics recomputed from the history) for both likelihoods, with and without condition() and riskset(); graphs exported; error paths.

Tested on macOS with Stata 17 BE (the plot test, the estat test and the old-plugin test, against core 3.29.0 and the plugin of the repository). Linux (Ubuntu 22.04) and Windows 11 with StataNow 19.5 MP: the plot test and the estat test pass with the plugins built by the CI workflow for this version (commit 6a36d3f). Stata 18 on the Mac was not run for this version.