. * nwrem tutorial 3: comparing specifications and limits . * Requires the core nwcommands and the package nwrem. . * Run from this folder; the data are in ../data. . . * --- declare the events (see tutorial 1) --- . import delimited "../data/calls_events.csv", clear (encoding automatically selected: ISO-8859-1) (3 vars, 439 obs) . 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') . . * --- five specifications --- . quietly nwrem calls, nodsnd nidrec . estimates store m1 . quietly nwrem calls, frpsndsnd frrecsnd . estimates store m2 . quietly nwrem calls, nodsnd nidrec frpsndsnd frrecsnd . estimates store m3 . quietly nwrem calls, rsndsnd rrecsnd . estimates store m4 . quietly nwrem calls, nodsnd nidrec rsndsnd rrecsnd . estimates store m5 . . * --- compare: log likelihood, number of parameters, AIC and BIC --- . estimates stats m1 m2 m3 m4 m5 Akaike's information criterion and Bayesian information criterion ----------------------------------------------------------------------------- Model | N ll(null) ll(model) df AIC BIC -------------+--------------------------------------------------------------- m1 | 439 . -3117.419 2 6238.837 6247.006 m2 | 439 . -2274.048 2 4552.096 4560.265 m3 | 439 . -2115.76 4 4239.519 4255.857 m4 | 439 . -2122.016 2 4248.032 4256.201 m5 | 439 . -1968.845 4 3945.689 3962.027 ----------------------------------------------------------------------------- Note: BIC uses N = number of observations. See [R] IC note. . lrtest m3 m1 Likelihood-ratio test Assumption: m1 nested within m3 LR chi2(2) = 2003.32 Prob > chi2 = 0.0000 . lrtest m3 m2 Likelihood-ratio test Assumption: m2 nested within m3 LR chi2(2) = 316.58 Prob > chi2 = 0.0000 . . * --- do the estimates depend on the optimiser's starting point? --- . nwrem calls, nodsnd nidrec frpsndsnd frrecsnd seed(1) ----------------------------------------------------------------------------- Relational event model (ordinal partial likelihood, MLE) Network: calls Actors: 84 Events: 439 Log likelihood: -2.12e+03 ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- calls | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- nodsnd | 5.392444 .437614 12.32 0.000 4.534736 6.250151 nidrec | .9485508 .5809881 1.63 0.103 -.190165 2.087267 frpsndsnd | 5.782833 .1612639 35.86 0.000 5.466762 6.098905 frrecsnd | 1.640031 .1538416 10.66 0.000 1.338507 1.941555 ----------------------------------------------------------------------------- . nwrem calls, nodsnd nidrec frpsndsnd frrecsnd seed(2) ----------------------------------------------------------------------------- Relational event model (ordinal partial likelihood, MLE) Network: calls Actors: 84 Events: 439 Log likelihood: -2.12e+03 ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- calls | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- nodsnd | 5.392423 .4376143 12.32 0.000 4.534715 6.250131 nidrec | .9485645 .5809885 1.63 0.103 -.1901521 2.087281 frpsndsnd | 5.78284 .1612634 35.86 0.000 5.46677 6.098911 frrecsnd | 1.640016 .1538413 10.66 0.000 1.338493 1.94154 ----------------------------------------------------------------------------- . . * --- what is refused --- . capture noisily nwrem calls nwrem requires at least one effect: nodsnd nidrec nidsnd nodrec ntdegsnd ntdegrec frpsndsnd frrecsnd covsnd() covrec() c > ovint() covevent() rsndsnd rrecsnd (see nwrem for what each computes; the development notes for what is not yet implem > ented). invalid syntax . display "return code: " _rc return code: 198 . capture noisily nwrem calls, frpsndsnd covsnd(nosuchvar) variable nosuchvar not found (error in option covsnd()) . display "return code: " _rc return code: 111 . . * --- a network that is not an event network --- . nwrandom 8, prob(.3) name(ordinary) . capture noisily nwrem ordinary, nodsnd nwrem requires a network declared via nwset's eventtime() option (an event-type temporal network) - see nwset. invalid syntax . display "return code: " _rc return code: 198 .