From d93693fcc74254345d59dbe986368719cf6d934a Mon Sep 17 00:00:00 2001
From: "Pavel N. Krivitsky"
Date: Thu, 10 Oct 2024 20:53:08 +1100
Subject: [PATCH] Added a logLik() method for ergm.ego objects, printing an
informative error message.
fixes statnet/ergm.ego#81
---
NAMESPACE | 1 +
R/summary.ergm.ego.R | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/NAMESPACE b/NAMESPACE
index f0f46b4..fe3a359 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -17,6 +17,7 @@ S3method(ergm.ego_get_vattr,"function")
S3method(ergm.ego_get_vattr,character)
S3method(ergm.ego_get_vattr,formula)
S3method(gof,ergm.ego)
+S3method(logLik,ergm.ego)
S3method(mixingmatrix,egor)
S3method(na.omit,egor)
S3method(plot,gof.ergm.ego)
diff --git a/R/summary.ergm.ego.R b/R/summary.ergm.ego.R
index 4009385..7938146 100644
--- a/R/summary.ergm.ego.R
+++ b/R/summary.ergm.ego.R
@@ -27,3 +27,9 @@ print.summary.ergm.ego <- function (x, ...){
NextMethod("print", object=x, ..., print.deviances=FALSE)
}
+#' @method logLik ergm.ego
+#' @export
+#' @noRd
+logLik.ergm.ego <- function(object, ...){
+ stop("Log-likelihood is not meaningful for moments-based inference used by ", sQuote("ergm.ego()"), ".")
+}