tergm icon indicating copy to clipboard operation
tergm copied to clipboard

Create a "wrapper" for LastToggle networks and dispatch on that?

Open krivit opened this issue 3 years ago • 0 comments

One way to resolve the dispatching issue including https://github.com/statnet/tergm/issues/25, and simplify the code in dispatching simulate_formula is by requiring the user to wrap LHS in something like Dynamic() which will set a minimal lasttoggle attribute and a class (e.g., c("lasttoggle_network","network")) so that simulate_formula.network() can go straight to ergm's version and simulate_formula.lasttoggle_network() would intercept only LT networks. (Right now, NetSeries() serves this function for conditional simulation, and ergm.multi makes heavy use of it with Layer() and Networks().

For example,

simulate(nw~...,...) # Cross-sectional simulation
simulate(NetSeries(nwlist)~...,...) # Cross-sectional simulation conditional on previous networks
simulate(Dynamic(nw)~...,...) # Dynamic simulation

and also

summary(nw~Form(~edges),...) # Error: nw is not known to contain previous time step information.
summary(NetSeries(nwlist)~Form(~edges),...) # Summary of transition statistics
summary(Dynamic(nw)~Form(~edges),...) # Works, assuming whatever the default lasttoggle structure is.

Dynamic() could also take time= and lasttoggle= argument and set them on the network object.

This is a bit of a last-minute change, but since it will simplify the code overall, it might be worth pushing through.

@chad-klumb , @martinamorris , @sgoodreau , @smjenness , what do you think? Also, any ideas about better names than Dynamic?

krivit avatar Jun 13 '21 00:06 krivit