data(fivenets)
ans <- ergmito(fivenets ~ edges + nodematch("female"))
# This computes the likelihood for all the networks independently
with(ans$formulae, {
exact_loglik(
x = target_stats,
params = coef(ans),
stats_weights = stats_weights,
stats_statmat = stats_statmat
)
})
# This should be close to zero
with(ans$formulae, {
exact_gradient(
x = target_stats,
params = coef(ans),
stats_weights = stats_weights,
stats_statmat = stats_statmat
)
})
# Finally, the hessian
with(ans$formulae, {
exact_hessian(
params = coef(ans),
stats_weights = stats_weights,
stats_statmat = stats_statmat
)
})
Run the code above in your browser using DataLab