From 93ecb250c990adbc70ad628d1fed88985f49aa69 Mon Sep 17 00:00:00 2001
From: "Pavel N. Krivitsky"
Date: Tue, 11 Jun 2024 00:09:32 +1000
Subject: [PATCH] single.impute.dyads() should not mess with networks when the
constraints are dyad-dependent.
---
DESCRIPTION | 4 ++--
R/ergm.utility.R | 6 ++++++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/DESCRIPTION b/DESCRIPTION
index 327b8edea..f3716cf8b 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,6 +1,6 @@
Package: ergm
-Version: 4.7-7367
-Date: 2024-06-05
+Version: 4.7-7368
+Date: 2024-06-11
Title: Fit, Simulate and Diagnose Exponential-Family Models for Networks
Authors@R: c(
person(c("Mark", "S."), "Handcock", role=c("aut"), email="handcock@stat.ucla.edu"),
diff --git a/R/ergm.utility.R b/R/ergm.utility.R
index b892dd73d..7a6dd276c 100644
--- a/R/ergm.utility.R
+++ b/R/ergm.utility.R
@@ -144,6 +144,12 @@ single.impute.dyads <- function(nw, constraints=NULL, constraints.obs=NULL, min_
response <- nw %ergmlhs% "response"
stopifnot(!is.null(constraints)||is.null(constraints.obs))
+ if(!is.dyad.independent(constraints) || !is.dyad.independent(constraints.obs)){
+ message("Model and/or observational constraints are not dyad-independent. Dyad imputation cannot be used. Please ensure your LHS network satisfies all constraints.")
+ if(output=="network") return(nw)
+ else return(ergm_state(nw))
+ }
+
if(!is.null(constraints)){
imputable <- as.rlebdm(constraints, constraints.obs, "missing")
nae <- NVL3(imputable, sum(.), 0)