. * nwdynam tutorial 3: what a small event log can and cannot tell you . * Requires the core nwcommands and the package nwdynam. . * Run from this folder; the data are in ../data. . . * --- a ten-event toy log (the example of the help file) --- . clear . input sender receiver t sender receiver t 1. 1 2 1 2. 1 3 2 3. 2 1 3 4. 1 2 4 5. 3 2 5 6. 2 3 6 7. 1 3 7 8. 3 1 8 9. 2 1 9 10. 1 3 10 11. end . nwset sender receiver, directed eventtime(t) name(chat) . nwdynam chat cannot compute an improvement -- flat region encountered ------------------------------------------------------------ Dynamic Network Actor Model - choice sub-model (MLE) Network: chat Actors: 3 Events: 10 Log likelihood: -3.9890 ------------------------------------------------------------ ------------------------------------------------------------ chat | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- inertia | -16.95435 4803.848 -0.00 0.997 -9432.324 9398.415 recip | -.6931435 1.224744 -0.57 0.571 -3.093598 1.707311 indeg | -19.78143 13962.73 -0.00 0.999 -27386.22 27346.66 ------------------------------------------------------------ Note: no usable standard error for inertia indeg. These effects are probably not identified (too few events, a perfectly predicted pattern, or effects that are linear functions of each other). Do not interpret their estimates; drop or recode the effect. . . * --- the real log: the first 60 events, then all 439 --- . * (the same 84 students in the risk set both times) . import delimited "../data/calls_events.csv", clear (encoding automatically selected: ISO-8859-1) (3 vars, 439 obs) . tempfile all . save `all' file /var/folders/hx/2zp2k5ps2y7d_6hx015fcr1h0000gn/T//S_10842.000001 saved as .dta format . foreach n in 60 120 240 439 { 2. use `all', clear 3. keep in 1/`n' 4. levelsof sender, local(a) clean 5. levelsof receiver, local(b) clean 6. local seen : list a | b 7. local miss 8. forvalues i = 1/84 { 9. if !`: list i in seen' local miss `miss',`i' 10. } 11. local miss = substr("`miss'", 2, .) 12. nwset sender receiver, directed eventtime(eventtime) name(first`n') 13. nwaddnodes first`n', nodenames(`miss') 14. } (379 observations deleted) 2 7 24 29 43 44 46 72 4 6 14 20 22 25 32 44 46 50 51 55 58 77 (319 observations deleted) 2 5 7 20 24 29 30 32 36 42 43 44 46 51 58 71 72 4 6 9 12 14 20 22 24 25 30 32 34 35 36 42 44 45 46 50 51 54 55 58 66 67 68 71 77 (199 observations deleted) 1 2 5 7 8 20 23 24 29 30 32 36 37 42 43 44 46 47 51 58 62 64 70 71 72 1 4 6 8 9 12 14 20 22 23 24 25 30 31 32 34 35 36 42 43 44 45 46 50 51 54 55 58 61 64 66 67 68 70 71 74 77 (0 observations deleted) 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 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 . nwdynam first60, inertia recip ------------------------------------------------------------ Dynamic Network Actor Model - choice sub-model (MLE) Network: first60 Actors: 84 Events: 60 Log likelihood: -106.2032 ------------------------------------------------------------ ------------------------------------------------------------ first60 | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- inertia | 5.923066 .4134493 14.33 0.000 5.11272 6.733412 recip | .3139963 .8760043 0.36 0.720 -1.402941 2.030933 ------------------------------------------------------------ . nwdynam first439, inertia recip ------------------------------------------------------------ Dynamic Network Actor Model - choice sub-model (MLE) Network: first439 Actors: 84 Events: 439 Log likelihood: -697.3087 ------------------------------------------------------------ ------------------------------------------------------------ first439 | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- inertia | 5.207598 .1740419 29.92 0.000 4.866482 5.548714 recip | 1.342851 .1646743 8.15 0.000 1.020096 1.665607 ------------------------------------------------------------ . . * --- how the precision of 'recip' grows with the number of events --- . foreach n in 60 120 240 439 { 2. quietly nwdynam first`n', inertia recip 3. matrix b = e(b) 4. matrix V = e(V) 5. display "events " %3.0f e(N) ": recip = " %6.3f b[1,2] " s.e. = " %6.3f sqrt(V[2,2]) 6. } events 60: recip = 0.314 s.e. = 0.876 events 120: recip = 1.704 s.e. = 0.466 events 240: recip = 1.730 s.e. = 0.264 events 439: recip = 1.343 s.e. = 0.165 . . * --- more effects on the short log --- . nwdynam first60, inertia recip indeg trans ------------------------------------------------------------ Dynamic Network Actor Model - choice sub-model (MLE) Network: first60 Actors: 84 Events: 60 Log likelihood: -106.1217 ------------------------------------------------------------ ------------------------------------------------------------ first60 | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- inertia | 6.252711 1.050194 5.95 0.000 4.194369 8.311054 recip | .3090334 .8766641 0.35 0.724 -1.409197 2.027263 indeg | -.3645551 1.044636 -0.35 0.727 -2.412005 1.682894 trans | -8.170142 588.795 -0.01 0.989 -1162.187 1145.847 ------------------------------------------------------------ Note: no usable standard error for trans. These effects are probably not identified (too few events, a perfectly predicted pattern, or effects that are linear functions of each other). Do not interpret their estimates; drop or recode the effect. . . * --- effects that do not belong to a sub-model are refused --- . capture noisily nwdynam first439, submodel(rate) recip inertia/recip/same()/diff()/sim()/alter()/trans/cycle/commonsender/commonreceiver/four/egoalterint()/tie() are choice su > b-model effects (submodel(choice)), not available with submodel(rate) - see nwdynam. invalid syntax . display "return code: " _rc return code: 198 .