statnet / tergm

Fit, Simulate and Diagnose Models for Network Evolution Based on Exponential-Family Random Graph Models
Other
27 stars 6 forks source link

not clear Change works with durational terms or durational operators inside of it #60

Open chad-klumb opened 3 years ago

chad-klumb commented 3 years ago

e.g.

require(tergm)
set.seed(0)
nw <- network.initialize(100, dir = F)
nw <- simulate(nw ~ edges, coef = c(-4), dynamic = TRUE, time.slices = 10, output = "final", monitor = ~Change(~edges + triangle + mean.age + Form(~edges + triangle + mean.age)))
attributes(nw)$stats

produces

> attributes(nw)$stats
Markov Chain Monte Carlo (MCMC) output:
Start = 1 
End = 10 
Thinning interval = 1 
      Change~edges Change~triangle Change~mean.age Change~Form~edges Change~Form~triangle Change~Form~mean.age
 [1,]           78               1        1.000000                78                    1             1.000000
 [2,]          182               5        2.417582               184                    5             1.423913
 [3,]          195              13        3.533333               197                   26             1.554312
 [4,]          176              11        4.522727               101                    6             1.673013
 [5,]          176               7        5.505682                -3                  -22             1.690365
 [6,]          186               9        6.505376               -85                  -45             1.682063
 [7,]          172               5        7.575581              -183                  -66             1.772168
 [8,]          162               3        8.549383              -290                  -85             1.819206
 [9,]          177               4        9.536723              -369                 -105             1.691192
[10,]          189              16       10.597884              -442                 -105             1.662247

I'm surprised to see negative ~Change(~Form(~edges)) and ~Change(~Form(~triangle)) statistics

also not totally clear to me that ~Change(~mean.age) is correct in any sense of the word (but maybe I just need to think about it more)

chad-klumb commented 3 years ago

I would add that it's starting from an empty network (with no time or lasttoggle attached), so I wouldn't expect lasttoggle initialization to be a major issue here.

krivit commented 3 years ago

I wouldn't expect it to work with durational operators, so I am not too concerned about that; I would prefer trying to nest them to fail with an error, but I can't think of a good way to do that off the top of my head. Durational terms should work, though as we discussed in the other thread, some statistics are poorly defined for other durational operators, so Change is not special in that sense.