statnet / ergm

Fit, Simulate and Diagnose Exponential-Family Models for Networks
Other
94 stars 36 forks source link

Tests in `test-nodrop.R` should capture and test for the warnings that result. #515

Closed krivit closed 1 year ago

krivit commented 1 year ago

Checks report the following:

── Warning ('test-nodrop.R:26'): empty network ─────────────────────────────────
Network is empty and no target stats are specified.
Backtrace:
 1. base::summary(ergm(y0 ~ edges, control = control.ergm(drop = FALSE)))
      at test-nodrop.R:26:2
 2. ergm::ergm(y0 ~ edges, control = control.ergm(drop = FALSE))
── Warning ('test-nodrop.R:26'): empty network ─────────────────────────────────
Observed statistic(s) edges are at their smallest attainable values and drop=FALSE. The MLE is poorly defined.
Backtrace:
 1. base::summary(ergm(y0 ~ edges, control = control.ergm(drop = FALSE)))
      at test-nodrop.R:26:2
 2. ergm::ergm(y0 ~ edges, control = control.ergm(drop = FALSE))
 3. ergm:::ergm.checkextreme.model(...)
── Warning ('test-nodrop.R:26'): empty network ─────────────────────────────────
The MPLE does not exist!
Backtrace:
 1. base::summary(ergm(y0 ~ edges, control = control.ergm(drop = FALSE)))
      at test-nodrop.R:26:2
 2. ergm::ergm(y0 ~ edges, control = control.ergm(drop = FALSE))
 3. ergm:::ergm.fit(...)
 4. ergm:::ergm.initialfit(...)
 5. ergm:::ergm.mple(...)
 6. ergm:::mple.existence(pl)
── Warning ('test-nodrop.R:28'): empty network ─────────────────────────────────
Network is empty and no target stats are specified.
Backtrace:
 1. base::summary(...)
      at test-nodrop.R:28:2
 2. ergm::ergm(...)
── Warning ('test-nodrop.R:28'): empty network ─────────────────────────────────
Observed statistic(s) edges are at their smallest attainable values and drop=FALSE. The MLE is poorly defined.
Backtrace:
 1. base::summary(...)
      at test-nodrop.R:28:2
 2. ergm::ergm(...)
 3. ergm:::ergm.checkextreme.model(...)
── Warning ('test-nodrop.R:34'): full network ──────────────────────────────────
Observed statistic(s) edges are at their greatest attainable values and drop=FALSE. The MLE is poorly defined.
Backtrace:
 1. base::summary(ergm(y1 ~ edges, control = control.ergm(drop = FALSE)))
      at test-nodrop.R:34:2
 2. ergm::ergm(y1 ~ edges, control = control.ergm(drop = FALSE))
 3. ergm:::ergm.checkextreme.model(...)
── Warning ('test-nodrop.R:34'): full network ──────────────────────────────────
The MPLE does not exist!
Backtrace:
 1. base::summary(ergm(y1 ~ edges, control = control.ergm(drop = FALSE)))
      at test-nodrop.R:34:2
 2. ergm::ergm(y1 ~ edges, control = control.ergm(drop = FALSE))
 3. ergm:::ergm.fit(...)
 4. ergm:::ergm.initialfit(...)
 5. ergm:::ergm.mple(...)
 6. ergm:::mple.existence(pl)
── Warning ('test-nodrop.R:36'): full network ──────────────────────────────────
Observed statistic(s) edges are at their greatest attainable values and drop=FALSE. The MLE is poorly defined.
Backtrace:
 1. base::summary(...)
      at test-nodrop.R:36:2
 2. ergm::ergm(...)
 3. ergm:::ergm.checkextreme.model(...)

They should be wrapped in expect_warning() with an appropriate regex.