trim_netest | R Documentation |
netest
ObjectTrims formula environments from the netest
object.
Optionally converts the newnetwork
element of the
netest
object to a networkLite
class, and removes
the fit
element (if present) from the netest
object.
trim_netest(
object,
as.networkLite = TRUE,
keep.fit = FALSE,
keep = character(0)
)
object |
A |
as.networkLite |
If |
keep.fit |
If |
keep |
Character vector of object names to keep in formula environments. By default, all objects are removed. |
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
.
A netest
object with formula environments trimmed, optionally with the
newnetwork
element converted to a networkLite
and the
fit
element removed.
nw <- network_initialize(n = 100)
formation <- ~edges + concurrent
target.stats <- c(50, 25)
coef.diss <- dissolution_coefs(dissolution = ~offset(edges), duration = 10)
est <- netest(nw, formation, target.stats, coef.diss,
set.control.ergm = control.ergm(MCMC.burnin = 1e5,
MCMC.interval = 1000))
print(object.size(est), units = "KB")
est.small <- trim_netest(est)
print(object.size(est.small), units = "KB")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.