Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: migraph
Title: Inferential Methods for Multimodal and Other Networks
Version: 1.5.6
Date: 2025-11-19
Version: 1.5.7
Date: 2026-02-18
Description: A set of tools for testing networks.
It includes functions for univariate and multivariate
conditional uniform graph and quadratic assignment procedure testing,
Expand Down
5 changes: 4 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,21 @@
S3method(glance,ergm)
S3method(glance,netlm)
S3method(glance,netlogit)
S3method(glance,sienaFit)
S3method(predict,netlm)
S3method(predict,netlogit)
S3method(print,diffs_model)
S3method(print,ergm)
S3method(print,netlm)
S3method(print,netlogit)
S3method(print,network_test)
S3method(print,over_memb)
S3method(summary,diffs_model)
S3method(summary,ergm)
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing S3method(print,ergm) and registering S3method(summary,ergm) is a behavioral breaking change for ergm objects and will also override ergm’s own summary.ergm() method. Given the recursion issue with tidy.ergm()/glance.ergm(), it’s safer to keep the custom printer as print.ergm() (if desired) and avoid registering summary.ergm() for the ergm class.

Suggested change
S3method(summary,ergm)

Copilot uses AI. Check for mistakes.
S3method(summary,sienaFit)
S3method(tidy,ergm)
S3method(tidy,netlm)
S3method(tidy,netlogit)
S3method(tidy,sienaFit)
export("%>%")
export(glance)
export(net_regression)
Expand Down
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# migraph 1.5.7

2026-02-18

- Using fict_marvel in tests
- Added tidy(), glance(), and summary() methods for sienaFit class objects
- Added summary.ergm()

# migraph 1.5.6

2025-11-19
Expand Down
30 changes: 29 additions & 1 deletion R/class_models.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,17 @@ tidy.ergm <- function(
dplyr::as_tibble(ret)
}

#' @method tidy sienaFit
#' @export
tidy.sienaFit <- function(ans){
tibble::tibble(
dv = ans$effects$name,
term = ans$effects$effectName,
estimate = ans$theta,
se = ans$se,
tstat = ans$theta/ans$se
Comment on lines +107 to +108
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tidy.sienaFit() introduces non-standard column names (se, tstat) compared with the other tidy.* methods here (std.error, statistic, p.value). This inconsistency can break downstream code that expects broom-like columns. Consider aligning the column names with the existing tidy.* outputs (keeping extra columns like dv if needed).

Suggested change
se = ans$se,
tstat = ans$theta/ans$se
std.error = ans$se,
statistic = ans$theta/ans$se

Copilot uses AI. Check for mistakes.
Comment on lines +102 to +108
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tidy.sienaFit() does not accept ..., so generics::tidy() calls that pass additional arguments will error with “unused argument”. To stay compatible with the generics/broom style used elsewhere in this file (e.g., tidy.netlm, tidy.ergm), add a ... parameter (and preferably name the first argument x).

Suggested change
tidy.sienaFit <- function(ans){
tibble::tibble(
dv = ans$effects$name,
term = ans$effects$effectName,
estimate = ans$theta,
se = ans$se,
tstat = ans$theta/ans$se
tidy.sienaFit <- function(x, ...) {
tibble::tibble(
dv = x$effects$name,
term = x$effects$effectName,
estimate = x$theta,
se = x$se,
tstat = x$theta / x$se

Copilot uses AI. Check for mistakes.
)
}
Comment on lines +100 to +110
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New S3 methods are added for tidy.sienaFit, glance.sienaFit, and summary.sienaFit, but there are no tests asserting dispatch and basic output shape/column names (contrast with tests/testthat/test-model_regression.R which tests tidy()/glance() for netlm/netlogit). Adding a small test fixture (or mocking a minimal sienaFit-like object if feasible) would help prevent regressions.

Copilot uses AI. Check for mistakes.

#' @importFrom generics glance
#' @export
Expand Down Expand Up @@ -239,6 +250,15 @@ glance.ergm <- function(x, deviance = FALSE, mcmc = FALSE, ...) {
ret
}

#' @method glance sienaFit
#' @export
glance.sienaFit <- function(ans){
tibble::tibble(
tmax = ans$tmax,
tconv.max = ans$tconv.max[,1]
Comment on lines +255 to +258
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

glance.sienaFit() does not accept ..., so generics::glance() calls that pass additional arguments will error with “unused argument”. For compatibility with the generic (and with the other glance.* methods in this file), add a ... parameter (and preferably name the first argument x).

Suggested change
glance.sienaFit <- function(ans){
tibble::tibble(
tmax = ans$tmax,
tconv.max = ans$tconv.max[,1]
glance.sienaFit <- function(x, ...) {
tibble::tibble(
tmax = x$tmax,
tconv.max = x$tconv.max[, 1]

Copilot uses AI. Check for mistakes.
)
}

#' @export
print.netlm <- function(x, ...){
cat("# Fitted model results\n")
Expand All @@ -256,7 +276,15 @@ print.netlogit <- function(x, ...){
}

#' @export
print.ergm <- function(x, ...){
summary.ergm <- function(x, ...){
cat("# Fitted model results\n")
print(tidy(x))
cat("\n# Model summary statistics\n")
print(glance(x))
}
Comment on lines +279 to +284
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defining a new summary.ergm() here will mask ergm’s own summary.ergm() method when migraph is loaded, and it also creates an infinite recursion: summary.ergm() calls tidy(x), but tidy.ergm() calls summary(x, ...), which will dispatch back to this summary.ergm(). This will break tidy.ergm(), glance.ergm(), and summary() for ergm fits. Consider restoring print.ergm() (as before) and not registering summary.ergm(), or implement a non-conflicting helper (or a method for a migraph-specific subclass) that does not override ergm’s summary method.

Copilot uses AI. Check for mistakes.

#' @export
summary.sienaFit <- function(x, ...){
cat("# Fitted model results\n")
print(tidy(x))
cat("\n# Model summary statistics\n")
Expand Down
2 changes: 1 addition & 1 deletion cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@

0 errors | 0 warnings | 0 notes

- Fixed CRAN errors
- This release is required to avoid a reverse dependency issue because of renaming some data in the manynet package
6 changes: 2 additions & 4 deletions tests/testthat/test-model_tests.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# # Making sure the tests family of functions works as intended.
marvel_friends <- manynet::to_giant(manynet::to_unsigned(manynet::ison_marvel_relationships)) %>%
marvel_friends <- manynet::to_uniplex(manynet::fict_marvel, "relationship") %>%
manynet::to_giant() %>% manynet::to_unsigned() %>%
manynet::to_subgraph(PowerOrigin == "Human")
cugtest <- test_random(marvel_friends,
manynet::net_heterophily,
Expand Down Expand Up @@ -38,9 +39,6 @@ test_that("test_random works", {
})

# Set the qaptest up
marvel_friends <- manynet::to_unsigned(manynet::ison_marvel_relationships)
marvel_friends <- manynet::to_giant(marvel_friends)
marvel_friends <- manynet::to_subgraph(marvel_friends, PowerOrigin == "Human")
qaptest <- test_permutation(marvel_friends,
manynet::net_heterophily,
attribute = "Attractive",
Expand Down
Loading