. * nwdynam tutorial 1: a first DyNAM on a phone-call event log . * Requires the core nwcommands and the package nwdynam. . * Run from this folder; the data are in ../data (events and actor attributes). . . nwdynam version nwdynam version 1.1.3, 26oct2026 core package nwcommands : installed (development copy, no distribution date) native plugin : .../d/dynam_sim_macos.plugin (ships with the package, no separate version number) compared with : R goldfish 1.6.12 license : GNU GPL-3 . . * --- the event data: one row per call, with the time it happened --- . import delimited "../data/calls_events.csv", clear (encoding automatically selected: ISO-8859-1) (3 vars, 439 obs) . list in 1/5 +--------------------------------+ | sender receiver eventtime | |--------------------------------| 1. | 72 50 1220733470 | 2. | 43 51 1221102974 | 3. | 43 51 1221784293 | 4. | 43 22 1221785882 | 5. | 43 55 1221787264 | +--------------------------------+ . count 439 . display "span in days: " (eventtime[_N] - eventtime[1]) / 86400 span in days: 42.125949 . duplicates report sender receiver Duplicates in terms of sender receiver -------------------------------------- Copies | Observations Surplus ----------+--------------------------- 1 | 36 0 2 | 26 13 3 | 30 20 4 | 32 24 6 | 6 5 7 | 35 30 8 | 24 21 9 | 9 8 10 | 10 9 11 | 11 10 13 | 26 24 15 | 15 14 64 | 64 63 115 | 115 114 -------------------------------------- . . * --- declare the events as an event network --- . * The log mentions 54 of the 84 students; the other 30 never call or are called. . * They still belong to the risk set, so we add them as isolates. . levelsof sender, local(a) clean 1 2 5 7 8 11 16 20 21 23 24 27 29 30 31 32 36 37 42 43 44 46 47 51 55 58 62 64 66 67 68 70 71 72 . levelsof receiver, local(b) clean 1 3 4 6 8 9 11 12 14 16 20 21 22 23 24 25 27 30 31 32 33 34 35 36 42 43 44 45 46 50 51 54 55 58 60 61 63 64 66 67 68 70 > 71 74 76 77 . local all : list a | b . local miss . forvalues i = 1/84 { 2. if !`: list i in all' local miss `miss',`i' 3. } . local miss = substr("`miss'", 2, .) . nwset sender receiver, directed eventtime(eventtime) name(calls) . nwaddnodes calls, nodenames(`miss') . nwset (1 networks) -------------------- calls . . * --- the choice sub-model (the default) --- . nwdynam calls -------------------------------------- Dynamic Network Actor Model - choice sub-model (MLE) Network: calls Actors: 84 Events: 439 Log likelihood: -695.4608 -------------------------------------- -------------------------------------- calls | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- inertia | 5.365619 .1937551 27.69 0.000 4.985866 5.745372 recip | 1.389441 .167288 8.31 0.000 1.061562 1.717319 indeg | -.1735184 .0909708 -1.91 0.056 -.3518179 .0047811 -------------------------------------- . . * --- the rate sub-model --- . nwdynam calls, submodel(rate) -------------------------------------- Dynamic Network Actor Model - rate sub-model, no intercept (MLE) Network: calls Actors: 84 Events: 439 Log likelihood: -1.75e+03 -------------------------------------- -------------------------------------- calls | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- indeg | .5514472 .0663444 8.31 0.000 .4214147 .6814798 outdeg | .2637836 .028386 9.29 0.000 .208148 .3194193 -------------------------------------- . . * --- stored results --- . display "sub-model: " e(submodel) ", effects: " e(effects) sub-model: rate, effects: indeg outdeg . display "events: " e(N) ", actors: " e(nodes) ", log likelihood: " %9.2f e(ll) events: 439, actors: 84, log likelihood: -1750.91 . display "odds ratio of reciprocity in the choice model: " %6.2f exp(1.389441) odds ratio of reciprocity in the choice model: 4.01 .