Skip to content

Commit 7c2d06d

Browse files
committed
Documented and exported ergm_conlist() methods.
1 parent e3a1c2e commit 7c2d06d

4 files changed

Lines changed: 95 additions & 34 deletions

File tree

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: ergm
2-
Version: 4.12.1-8001
2+
Version: 4.12.1-8002
33
Date: 2026-02-27
44
Title: Fit, Simulate and Diagnose Exponential-Family Models for Networks
55
Authors@R: c(

NAMESPACE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ S3method("%ergmlhs%",network)
66
S3method("%ergmlhs%<-",ergm_state_full)
77
S3method("%ergmlhs%<-",network)
88
S3method("-",ergm_levels_spec_function)
9+
S3method("[",ergm_conlist)
910
S3method("param_names<-",ergm_model)
1011
S3method(AIC,ergm)
1112
S3method(BIC,ergm)
@@ -34,6 +35,7 @@ S3method(as.rlebdm,ergm_state)
3435
S3method(as.rlebdm,matrix)
3536
S3method(as.rlebdm,network)
3637
S3method(as.rlebdm,rlebdm)
38+
S3method(c,ergm_conlist)
3739
S3method(c,ergm_model)
3840
S3method(coef,ergm)
3941
S3method(compress,rlebdm)
@@ -58,6 +60,10 @@ S3method(ergm_attr_levels,list)
5860
S3method(ergm_attr_levels,logical)
5961
S3method(ergm_attr_levels,matrix)
6062
S3method(ergm_attr_levels,numeric)
63+
S3method(ergm_conlist,"NULL")
64+
S3method(ergm_conlist,ergm_conlist)
65+
S3method(ergm_conlist,formula)
66+
S3method(ergm_conlist,term_list)
6167
S3method(ergm_get_vattr,"function")
6268
S3method(ergm_get_vattr,AsIs)
6369
S3method(ergm_get_vattr,character)
@@ -238,6 +244,7 @@ export(ergm_MCMC_slave)
238244
export(ergm_SAN_slave)
239245
export(ergm_attr_levels)
240246
export(ergm_bd_init)
247+
export(ergm_conlist)
241248
export(ergm_cutoff_message)
242249
export(ergm_dyadgen_select)
243250
export(ergm_edgecov_args)

R/ergm_proposal.R

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -243,44 +243,38 @@ ergm_proposal.character <- function(object, arguments, nw, ..., reference=ergm_r
243243
}
244244

245245

246-
247-
248-
249-
########################################################################################
250-
# The <ergm_proposal.formula> function verifies that the given constraints exist and
251-
# are supported in conjuction with the given weights and class by a unique proposal;
252-
# if so the ergm_proposal object is created via <ergm_proposal.character> using the
253-
# proposal type found in the look-up table above.
254-
#
255-
# --PARAMETERS--
256-
# object : a one-sided formula of constraint terms ( ~ term(s))
257-
# arguments : a list of parameters used by the <InitErgmProposal> routines possibly including
258-
# bd: a list of parameters used to bound degree via <ergm.bounddeg>
259-
# nw : a network object
260-
# constraints: the constraints as a one sided formula '~ term(s)'
261-
# weights : specifies the method used to allocate probabilities of being proposed
262-
# to dyads; options are "TNT", "StratTNT", "TNT10", "random", "nonobserved" and
263-
# "default"; default="default"
264-
# class : the class of the proposal; choices include "c", "f", and "d"
265-
# default="c"
266-
#
267-
########################################################################################
268-
269-
#' @noRd
246+
#' Internal representation of ERGM sample space constraints and hints
247+
#'
248+
#' See [`ergmConstraint`] for details on specifying proposals and
249+
#' constraints.
250+
#'
251+
#' @param object a data type
252+
#'
253+
#' @keywords internal
254+
#' @export
270255
ergm_conlist <- function(object, ...) UseMethod("ergm_conlist")
271256

272-
#' @noRd
257+
#' @describeIn ergm_conlist identity method.
258+
#' @export
273259
ergm_conlist.ergm_conlist <- function(object, ...) object
274260

275-
#' @noRd
261+
#' @describeIn ergm_conlist handling for `NULL`, to simplify other code.
262+
#' @export
276263
ergm_conlist.NULL <- function(object, ...) NULL
277264

278-
#' @noRd
279-
ergm_conlist.formula <- function(object, nw, ..., term.options=list())
280-
object %>% .embed_constraint_lhs() %>% list_rhs.formula() %>%
281-
ergm_conlist(nw, ..., term.options=term.options)
265+
#' @describeIn ergm_conlist initialize from [`formula`], such as in
266+
#' [ergm()] `constraints` and `obs.constraints` arguments: preserve
267+
#' the LHS, convert to [`term_list`], and use the nxt method.
268+
#'
269+
#' @param nw a [`network`] object.
270+
#' @template term_options
271+
#'
272+
#' @export
273+
ergm_conlist.formula <- function(object, nw, ...)
274+
object |> .embed_constraint_lhs() |> list_rhs.formula() |> ergm_conlist(nw, ...)
282275

283-
#' @noRd
276+
#' @describeIn ergm_conlist initialize from [`term_list`].
277+
#' @export
284278
ergm_conlist.term_list <- function(object, nw, ..., term.options=list()){
285279
object <-
286280
if(is(object, "AsIs")) structure(object, class = class(object)[class(object) != "AsIs"])
@@ -309,10 +303,12 @@ ergm_conlist.term_list <- function(object, nw, ..., term.options=list()){
309303
prune.ergm_conlist(conlist)
310304
}
311305

312-
#' @noRd
306+
#' @describeIn ergm_conlist a concatenation method.
307+
#' @export
313308
c.ergm_conlist <- function(...) NextMethod() %>% prune.ergm_conlist()
314309

315-
#' @noRd
310+
#' @describeIn ergm_conlist a subsetting method.
311+
#' @export
316312
`[.ergm_conlist` <- function(x, ...){
317313
structure(NextMethod(), class = "ergm_conlist")
318314
}

man/ergm_conlist.Rd

Lines changed: 58 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)