With larger, more complex network structures with epidemic models, it is
generally useful to reduce the memory footprint of the fitted TERGM model
object (estimated with netest). This utility function removes
all but the bare essentials needed for simulating a network model with
netsim.
The function always trims the environments of object$constraints and
object$coef.diss$dissolution.
When both edapprox = TRUE and nested.edapprox = TRUE in the
netest call, also trims the environments of object$formula
and object$formation.
When both edapprox = TRUE and nested.edapprox = FALSE in the
netest call, also trims the environments of object$formula,
environment(object$formation)$formation, and
environment(object$formation)$dissolution.
When edapprox = FALSE in the netest call, also trims the
environments of object$formation,
environment(object$formula)$formation and
environment(object$formula)$dissolution.
By default all objects are removed from these trimmed environments. Specific
objects may be retained by passing their names as the keep argument.
For the output of trim_netest to be usable in netsim
simulation, any objects referenced in the formulas should be included in the
keep argument.
If as.networkLite = TRUE, converts object$newnetwork to a
networkLite object. If keep.fit = FALSE, removes fit (if
present) from object.