Skip to content

Commit

Permalink
single.impute.dyads() should not mess with networks when the constrai…
Browse files Browse the repository at this point in the history
…nts are dyad-dependent.
  • Loading branch information
krivit committed Jun 13, 2024
1 parent aaf1ffb commit 93ecb25
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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="[email protected]"),
Expand Down
6 changes: 6 additions & 0 deletions R/ergm.utility.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 93ecb25

Please sign in to comment.