Skip to content

Commit

Permalink
Add a test for Godambe cov of MPLE with offset
Browse files Browse the repository at this point in the history
References #561.
  • Loading branch information
mbojan committed Jun 10, 2024
1 parent 1548fb7 commit 9da280e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/testthat/test-mple-cov.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ test_that("Godambe covariance method for MPLE", {
expect_equal(StdErr1, c(0.255, 0.059), ignore_attr = TRUE, tolerance=.05)
})

test_that("Godambe covariance method for MPLE with offset", {
set.seed(111)
fit <- ergm(
init.sim ~ edges + triangles + offset(edges),
offset.coef = 0,
estimate = "MPLE",
control=control.ergm(MPLE.covariance.method = "Godambe")
)
StdErr <- sqrt(diag(vcov(fit)))
expect_equal(StdErr, c(0.255, 0.059, 0), ignore_attr = TRUE, tolerance=.05)
})

test_that("Inverse Hessian from logistic regression model", {
set.seed(222) # However, this method is not stochastic
m2 <- ergm(init.sim ~ edges+triangles, estimate = "MPLE",
Expand All @@ -50,3 +62,5 @@ test_that("Bootstrap covariance method for MPLE with offsets", {
StdErr4 <- sqrt(diag(vcov(m4)))
expect_equal(StdErr4, c(0.155, 0.034, 0), ignore_attr = TRUE, tolerance=.05)
})


0 comments on commit 9da280e

Please sign in to comment.