We currently have no way of removing entries from ergm_proposal_table(), which should happen whenever an extension package is unloaded. This leads to the following:
suppressPackageStartupMessages(library(ergm))
data(florentine)
flomarriage %e% "w" <- 0
dummy <- simulate(flomarriage~sum, response="w", reference=~DiscUnif(0,5), verbose=TRUE,
control=snctrl(MCMC.burnin=0, MCMC.interval=1))
#> Initializing unconstrained Metropolis-Hastings proposal: Best valid proposal 'DiscUnif' cannot take into account hint(s) 'sparse'.
#> 'ergm:MH_DiscUnif'.
#> Initializing model...
#> Model initialized.
#> Warning in simulate.ergm_model(m, nsim = nsim, seed = seed, coef = coef, : No
#> parameter values given, using Bernouli network.
#> Starting MCMC iterations to generate 1 network
suppressPackageStartupMessages(library(ergm.count))
dummy <- simulate(flomarriage~sum, response="w", reference=~DiscUnif(0,5), verbose=TRUE,
control=snctrl(MCMC.burnin=0, MCMC.interval=1))
#> Initializing unconstrained Metropolis-Hastings proposal: 'ergm.count:MH_DiscTNT'.
#> Initializing model...
#> Model initialized.
#> Warning in simulate.ergm_model(m, nsim = nsim, seed = seed, coef = coef, : No
#> parameter values given, using Bernouli network.
#> Starting MCMC iterations to generate 1 network
unloadNamespace("ergm.count")
dummy <- simulate(flomarriage~sum, response="w", reference=~DiscUnif(0,5), verbose=TRUE,
control=snctrl(MCMC.burnin=0, MCMC.interval=1))
#> Initializing unconstrained Metropolis-Hastings proposal:
#> Error: Metropolis-Hastings proposal 'DiscTNT' function 'InitWtErgmProposal.DiscTNT' not found.
It may be possible to autodetect which package is calling ergm_proposal_table(), so that we could watch for that package unloading, but I wonder if a cleaner API is also possible.
We currently have no way of removing entries from
ergm_proposal_table()
, which should happen whenever an extension package is unloaded. This leads to the following:Created on 2022-11-21 with reprex v2.0.2
It may be possible to autodetect which package is calling
ergm_proposal_table()
, so that we could watch for that package unloading, but I wonder if a cleaner API is also possible.