Skip to content

Commit

Permalink
CMLE for networkDynamic now stops with an informative error if times=…
Browse files Browse the repository at this point in the history
… is not specified.

fixes #124
  • Loading branch information
krivit committed Oct 8, 2024
1 parent 3960a6b commit 4e5b788
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: tergm
Version: 4.2-2561
Version: 4.2-2562
Date: 2024-10-08
Title: Fit, Simulate and Diagnose Models for Network Evolution Based on Exponential-Family Random Graph Models
Authors@R: c(
Expand Down
2 changes: 2 additions & 0 deletions R/tergm.CMLE.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ tergm.CMLE <- function(formula, times, ..., control, basis) {
if(inherits(nw, "network.list") || (is.list(nw) && !is.network(nw) && is.network(nw[[1]]))){
NetSeries <- NetSeries(nw, NA.impute=control$CMLE.NA.impute)
}else if(inherits(nw,"networkDynamic")){
if(is.null(times)) stop("When estimating CMLE on ", sQuote("networkDynamic"), " data, you must specify ",
sQuote("times="), ".")
NetSeries <- NetSeries(nw, times, NA.impute=control$CMLE.NA.impute)
}else{
stop("Unsupported specification for the network series. See help for ",sQuote("NetSeries")," for arguments.")
Expand Down
14 changes: 7 additions & 7 deletions R/tergm.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@
#'
#' @param times For CMLE and CMPLE estimation, times or indexes at
#' which the networks whose transition is to be modeled are
#' observed. Default to \code{c(0,1)} if \code{nw} is a
#' \code{\link[networkDynamic]{networkDynamic}} and to
#' \code{1:length(nw)} (all transitions) if \code{nw} is a
#' \code{\link{network.list}} or a \code{\link{list}}. Unused for
#' EGMME. Note that at this time, the selected time points will be
#' treated as temporally adjacent. Irregluarly spaced time series
#' are not supported at this time.
#' observed. This argument is mandatory if \code{nw} is a
#' [`networkDynamic`] and defaults to \code{1:length(nw)} (all
#' transitions) if \code{nw} is a [`network.list`] or a
#' [`list`]. Ignored when estimating EGMME or if LHS is already a
#' [`NetSeries`]. Note that at this time, the selected time points
#' will be treated as temporally adjacent. Irregluarly spaced time
#' series are not supported at this time.
#'
#' @param offset.coef Numeric vector to specify offset parameters.
#' @param targets One-sided \code{\link{ergm}}-style formula specifying
Expand Down

0 comments on commit 4e5b788

Please sign in to comment.