Nothing
# File tests/testthat/test-valued-fit.R in package ergm.count, part of the
# Statnet suite of packages for network analysis, https://statnet.org .
#
# This software is distributed under the GPL-3 license. It is free,
# open source, and has the attribution requirements (GPL Section 7) at
# https://statnet.org/attribution .
#
# Copyright 2008-2022 Statnet Commons
################################################################################
test_that("Poisson-reference ERGM fit", {
set.seed(0)
n <- 5
m <- matrix(rpois(n^2,2),n,n)
diag(m) <- 0
y <- as.network(m, matrix.type="a", directed=TRUE, ignore.eval=FALSE, names.eval="w")
truth <- log(sum(m)/n/(n-1))
diag(m) <- NA
efit <- ergm(y ~ sum, response="w", reference=~Poisson, verbose=TRUE, control=control.ergm(MCMLE.effectiveSize=128))
summary(efit)
true.llk <- sum(dpois(na.omit(c(m)), exp(coef(efit)), log=TRUE)) - sum(dpois(na.omit(c(m)), 1, log=TRUE))
expect_lt(abs(coef(efit)-truth)/sqrt(vcov(efit, sources="estimation")), 3)
expect_lt(abs(true.llk - logLik(efit))/sqrt(attr(logLik(efit),"vcov")), 3)
})
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.