diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 09591c0..31f935c 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -28,6 +28,9 @@ # debug: compile package with -DDEBUG and -UNDEBUG # # covr: run in covr mode may be used with 'full' but probably not with others. +# +# +# Typical public, private, and release configurations are provided in the variables below. on: [push, pull_request] @@ -37,19 +40,23 @@ name: R-CMD-check env: PUBLIC: '' PRIVATE: '' + PUBLIC_CONFIG: '{"config":[ + {"os":"windows-latest", "r":"release", "timeout":360, "flags":"binaries"}, + {"os":"macOS-latest", "r":"release", "timeout":360, "flags":"binaries, ubsan"}, + {"os":"ubuntu-latest", "r":"release", "timeout":360, "flags":"full, ubsan, debug"}, + {"os":"ubuntu-latest", "r":"devel", "timeout":360, "flags":"vignettes, remote"}, + {"os":"ubuntu-latest", "r":"release", "timeout":360, "flags":"full, covr"}]}' + RELEASE_CONFIG: '{"config":[ + {"os":"windows-latest", "r":"release", "timeout":360, "flags":"binaries, vignettes, remote, strict"}, + {"os":"macOS-latest", "r":"release", "timeout":360, "flags":"binaries, ubsan, vignettes, remote, strict"}, + {"os":"ubuntu-latest", "r":"release", "timeout":360, "flags":"full, ubsan, debug, strict"}, + {"os":"ubuntu-latest", "r":"devel", "timeout":360, "flags":"vignettes, remote, strict"}, + {"os":"ubuntu-latest", "r":"release", "timeout":360, "flags":"full, covr, strict"}]}' + PRIVATE_CONFIG: '{"config":[ + {"os":"ubuntu-latest", "r":"release", "timeout":10, "flags":"none"} + ]}' jobs: -## Remove-Old-Artifacts: -## runs-on: ubuntu-latest -## timeout-minutes: 10 -## -## steps: -## - name: Remove old artifacts -## uses: c-hive/gha-remove-artifacts@v1.2.0 -## with: -## age: '1 month' -## skip-recent: 8 - Set-Matrix-Private: runs-on: ubuntu-latest outputs: @@ -87,24 +94,16 @@ jobs: run: | if [[ "${{ env.IAM }}" == 'public' ]] # Public: full set. then - config='{"config":[ - {"os":"windows-latest", "r":"release", "timeout":360, "flags":"remote, vignettes, strict, binaries"}, - {"os":"macOS-latest", "r":"release", "timeout":360, "flags":"remote, vignettes, strict, binaries, ubsan"}, - {"os":"ubuntu-20.04", "r":"release", "rspm":"https://packagemanager.rstudio.com/cran/__linux__/focal/latest", "timeout":360, "flags":"strict, full, ubsan, debug"}, - {"os":"ubuntu-20.04", "r":"devel", "rspm":"https://packagemanager.rstudio.com/cran/__linux__/focal/latest", "timeout":360, "flags":"strict, vignettes, remote"}, - {"os":"ubuntu-20.04", "r":"release", "rspm":"https://packagemanager.rstudio.com/cran/__linux__/focal/latest", "timeout":360, "flags":"full, covr"}]}' + config='${{ env.RELEASE_CONFIG }}' elif [[ "${{ env.FOUND_PUBLIC }}" != '0' ]] # Private with no public analogue: reduced set. then - config='{"config":[ - {"os":"ubuntu-20.04", "r":"release", "rspm":"https://packagemanager.rstudio.com/cran/__linux__/focal/latest", "timeout":10, "flags":"none"} - ]}' + config='${{ env.PRIVATE_CONFIG }}' else # Private with public analogue: no checking. config='' fi - config="${config//'%'/'%25'}" - config="${config//$'\n'/'%0A'}" - config="${config//$'\r'/'%0D'}" - echo "::set-output name=matrix::$config" + config="${config//$'\r'/' '}" + config="${config//$'\n'/' '}" + echo "matrix=$config" >> $GITHUB_OUTPUT R-CMD-check: needs: Set-Matrix-Private @@ -122,7 +121,6 @@ jobs: env: HOMEBREW_NO_INSTALL_CLEANUP: 1 R_REMOTES_NO_ERRORS_FROM_WARNINGS: true - RSPM: ${{ matrix.config.rspm }} steps: - name: If available, use the Janitor's key rather than the repository-specific key. @@ -136,60 +134,40 @@ jobs: fi shell: bash - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - uses: r-lib/actions/setup-r@v1 + - uses: r-lib/actions/setup-r@v2 with: + use-public-rspm: true r-version: ${{ matrix.config.r }} - - name: Install GhostScript (on Linux if running vignettes) + - name: Install tidy (on Linux if running vignettes) if: runner.os == 'Linux' && contains(matrix.config.flags, 'vignettes') run: | - /usr/bin/sudo DEBIAN_FRONTEND=noninteractive apt-get install -y ghostscript + /usr/bin/sudo DEBIAN_FRONTEND=noninteractive apt-get install -y tidy shell: bash - - uses: r-lib/actions/setup-pandoc@v1 + - uses: r-lib/actions/setup-pandoc@v2 - name: Install tinytex (system) if: contains(matrix.config.flags, 'vignettes') - uses: r-lib/actions/setup-tinytex@v1 + uses: r-lib/actions/setup-tinytex@v2 - - name: Query dependencies - run: | - install.packages('remotes') - saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) - writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") - shell: Rscript {0} - - - name: Cache R packages - if: runner.os != 'Windows' - uses: actions/cache@v2 + - uses: r-lib/actions/setup-r-dependencies@v2 with: - path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- - - - name: Install system dependencies - if: runner.os == 'Linux' - run: | - while read -r cmd - do - eval sudo $cmd - done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))') - sudo apt-get install -y libcurl4-openssl-dev - - - name: Install dependencies - run: | - remotes::install_deps(dependencies = TRUE) - remotes::install_cran("pkgbuild"); stopifnot(require("pkgbuild")) - remotes::install_cran("rcmdcheck"); stopifnot(require("rcmdcheck")) - remotes::install_cran("covr"); stopifnot(require("covr")) - shell: Rscript {0} + extra-packages: | + any::rcmdcheck + any::covr + any::V8 + any::xml2 + needs: | + check + coverage - name: Install tinytex (R) if: contains(matrix.config.flags, 'vignettes') run: | - remotes::install_cran("tinytex") + if(!requireNamespace("tinytex", quietly = TRUE)) pak::pkg_install("tinytex") tinytex:::install_yihui_pkgs() tinytex::tlmgr_install("makeindex") shell: Rscript {0} @@ -203,7 +181,7 @@ jobs: - name: Upload build results if: contains(matrix.config.flags, 'binaries') && !failure() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: ${{ runner.os }}-r${{ matrix.config.r }}-binaries path: binaries @@ -239,18 +217,21 @@ jobs: error_on <- if(Sys.getenv("FAIL_ON_WARN") == "true") "warning" else "error" + extra_flags <- c() + if(Sys.getenv("USE_UBSAN") == "true"){ - Sys.setenv(PKG_LIBS=paste(Sys.getenv("PKG_LIBS"), "-fsanitize=undefined"), - PKG_CFLAGS=paste(Sys.getenv("PKG_CFLAGS"), "-fsanitize=undefined"), - PKG_CXXFLAGS=paste(Sys.getenv("PKG_CXXFLAGS"), "-fsanitize=undefined"), - UBSAN_OPTIONS=paste(Sys.getenv("UBSAN_OPTIONS"), "print_stacktrace=1")) + extra_flags <- c(extra_flags, "-fsanitize=undefined") + Sys.setenv(UBSAN_OPTIONS=paste(Sys.getenv("UBSAN_OPTIONS"), "print_stacktrace=1")) } - if(Sys.getenv("SET_DEBUG") == "true"){ - Sys.setenv(PKG_LIBS=paste(Sys.getenv("PKG_LIBS"), "-UNDEBUG -DDEBUG"), - PKG_CXXFLAGS=paste(Sys.getenv("PKG_CXXFLAGS"), "-UNDEBUG -DDEBUG"), - PKG_CFLAGS=paste(Sys.getenv("PKG_CFLAGS"), "-UNDEBUG -DDEBUG")) - } + if(Sys.getenv("SET_DEBUG") == "true") extra_flags <- c(extra_flags, "-UNDEBUG", "-DDEBUG") + + # Before R 4.3.0, R itself was not compliant. + if(getRversion() >= "4.3") extra_flags <- c(extra_flags, "-Wstrict-prototypes") + + Sys.setenv(PKG_LIBS=paste(c(Sys.getenv("PKG_LIBS"), extra_flags), collapse=" "), + PKG_CXXFLAGS=paste(c(Sys.getenv("PKG_CXXFLAGS"), extra_flags), collapse=" "), + PKG_CFLAGS=paste(c(Sys.getenv("PKG_CFLAGS"), extra_flags), collapse=" ")) rcmdcheck::rcmdcheck(args = check_args, build_args = build_args, error_on = error_on, check_dir = "check") shell: Rscript {0} @@ -274,18 +255,13 @@ jobs: - name: Upload check results if: contains(matrix.config.flags, 'covr') == false && failure() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: ${{ runner.os }}-r${{ matrix.config.r }}-results path: | check !check/*/00_pkg_src - - name: Preinstall package to work around an issue in covr # can be removed after covr update - if: contains(matrix.config.flags, 'covr') - run: R CMD INSTALL . - shell: bash - - name: Test coverage if: contains(matrix.config.flags, 'covr') timeout-minutes: ${{ matrix.config.timeout }} @@ -293,5 +269,22 @@ jobs: _R_CHECK_CRAN_INCOMING_REMOTE_: false _R_CHECK_FORCE_SUGGESTS_: ${{ runner.os != 'macOS' }} # Rmpi is not available on macOS. ENABLE_statnet_TESTS: ${{ contains(matrix.config.flags, 'full') }} - run: covr::codecov(type=c("tests","examples")) + run: | + cov <- covr::package_coverage( + type=c("tests", "examples"), + quiet = FALSE, + clean = FALSE, + install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package") + ) + covr::to_cobertura(cov) shell: Rscript {0} + + - name: Upload coverage results + if: contains(matrix.config.flags, 'covr') + uses: codecov/codecov-action@v4 + with: + fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }} + file: ./cobertura.xml + plugin: noop + disable_search: true + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/DESCRIPTION b/DESCRIPTION index c108b69..0647760 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,20 +1,22 @@ Package: ergm.count -Version: 4.1.1 -Date: 2022-05-24 +Version: 4.1.2 +Date: 2024-06-15 Title: Fit, Simulate and Diagnose Exponential-Family Models for Networks with Count Edges Authors@R: c( - person("Pavel N.", "Krivitsky", role=c("aut","cre"), email="pavel@statnet.org", comment=c(ORCID="0000-0002-9101-3362")), - person("Mark S.", "Handcock", role=c("ctb"), email="handcock@stat.ucla.edu"), - person("David R.", "Hunter", role=c("ctb"), email="dhunter@stat.psu.edu"), + person(c("Pavel", "N."), "Krivitsky", role=c("aut","cre"), email="pavel@statnet.org", comment=c(ORCID="0000-0002-9101-3362")), + person(c("Mark", "S."), "Handcock", role=c("ctb"), email="handcock@stat.ucla.edu"), + person(c("David", "R."), "Hunter", role=c("ctb"), email="dhunter@stat.psu.edu"), person("Joyce", "Cheng", role=c("ctb"), email="joyce.cheng@student.unsw.edu.au")) Depends: ergm (>= 4.2.1), network (>= 1.15) Imports: - statnet.common (>= 4.2.0) + statnet.common (>= 4.2.0), + Rdpack (>= 2.4) LinkingTo: ergm -Description: A set of extensions for the 'ergm' package to fit weighted networks whose edge weights are counts. See Krivitsky (2012) and Krivitsky, Hunter, Morris, and Klumb (2021) . +RdMacros: Rdpack +Description: A set of extensions for the 'ergm' package to fit weighted networks whose edge weights are counts. See Krivitsky (2012) and Krivitsky, Hunter, Morris, and Klumb (2023) . License: GPL-3 + file LICENSE URL: https://statnet.org BugReports: https://github.com/statnet/ergm.count/issues @@ -24,7 +26,7 @@ Suggests: rmarkdown, testthat (>= 3.0.0) VignetteBuilder: rmarkdown, knitr -RoxygenNote: 7.2.0 +RoxygenNote: 7.3.1 Roxygen: list(markdown = TRUE) Encoding: UTF-8 Config/testthat/parallel: true diff --git a/LICENSE b/LICENSE index c13faf0..6c64379 100644 --- a/LICENSE +++ b/LICENSE @@ -36,4 +36,4 @@ Martina Morris, University of Washington The 'statnet' development team -Copyright 2008-2022 +Copyright 2008-2024 diff --git a/NAMESPACE b/NAMESPACE index 06fa6f0..a841783 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -3,4 +3,5 @@ import(ergm) import(network) import(statnet.common) +importFrom(Rdpack,reprompt) useDynLib(ergm.count) diff --git a/R/InitErgmReference.R b/R/InitErgmReference.R index c7b7e67..7b16f67 100644 --- a/R/InitErgmReference.R +++ b/R/InitErgmReference.R @@ -5,7 +5,7 @@ # open source, and has the attribution requirements (GPL Section 7) at # https://statnet.org/attribution . # -# Copyright 2008-2022 Statnet Commons +# Copyright 2008-2024 Statnet Commons ################################################################################ #' @templateVar name Poisson diff --git a/R/InitWtErgmProposal.R b/R/InitWtErgmProposal.R index d2b6598..8510c0b 100644 --- a/R/InitWtErgmProposal.R +++ b/R/InitWtErgmProposal.R @@ -5,7 +5,7 @@ # open source, and has the attribution requirements (GPL Section 7) at # https://statnet.org/attribution . # -# Copyright 2008-2022 Statnet Commons +# Copyright 2008-2024 Statnet Commons ################################################################################ #' @templateVar name Disc diff --git a/R/InitWtErgmTerm.R b/R/InitWtErgmTerm.R index 6b5ddfb..ae7fd14 100644 --- a/R/InitWtErgmTerm.R +++ b/R/InitWtErgmTerm.R @@ -5,7 +5,7 @@ # open source, and has the attribution requirements (GPL Section 7) at # https://statnet.org/attribution . # -# Copyright 2008-2022 Statnet Commons +# Copyright 2008-2024 Statnet Commons ################################################################################ #' @templateVar name CMP diff --git a/R/data.R b/R/data.R index fd8b514..dc1d509 100644 --- a/R/data.R +++ b/R/data.R @@ -5,7 +5,7 @@ # open source, and has the attribution requirements (GPL Section 7) at # https://statnet.org/attribution . # -# Copyright 2008-2022 Statnet Commons +# Copyright 2008-2024 Statnet Commons ################################################################################ #' Karate club social network of Zachary (1977) #' diff --git a/R/ergm.count-package.R b/R/ergm.count-package.R index 2ec17bc..f435fd7 100644 --- a/R/ergm.count-package.R +++ b/R/ergm.count-package.R @@ -5,7 +5,7 @@ # open source, and has the attribution requirements (GPL Section 7) at # https://statnet.org/attribution . # -# Copyright 2008-2022 Statnet Commons +# Copyright 2008-2024 Statnet Commons ################################################################################ #' Fit, Simulate and Diagnose Exponential-Family Models for Networks with Count #' Edges @@ -13,13 +13,16 @@ #' \code{\link[=ergm.count-package]{ergm.count}} is a set of extensions to #' package \code{\link[=ergm-package]{ergm}} to fit and simulate from #' exponential-family random graph models for networks whose edge weights are -#' counts. For a list of functions type \code{help(package='ergm')} and -#' \code{help(package='ergm.count')} +#' counts \insertCite{Kr12e}{ergm.count}. #' -#' Mainly, it implements Poisson, binomial, geometric, and discrete uniform -#' dyadwise reference measures for valued ERGMs -#' (documented here in [`ergmReference`]), and provides some count-specific -#' change statistics (documented in [`ergmTerm`]). +#' Mainly, it implements Poisson, binomial, geometric, and discrete +#' uniform dyadwise reference measures for valued ERGMs (documented +#' here in [`ergmReference`]), and provides some count-specific change +#' statistics (documented in [`ergmTerm`]) +#' \insertCite{Kr12e,KrHu23e}{ergm.count}, including +#' [`CMP`][CMP-ergmTerm] for the Conway--Maxwell--Poisson Distribution +#' \insertCite{ShMi05u}{ergm.count}. + #' #' For a complete list of the functions, use \code{library(help="ergm")} and #' \code{library(help="ergm.count")} or read the rest of the manual. @@ -33,12 +36,6 @@ #' model networks whose dyad values are counts. Examples include counts of #' conversations, messages, and other interactions. #' -#' In particular, this package implements the Poisson, geometric, binomial, and -#' discrete uniform reference measures (documented in -#' [`ergmReference`] for use by \code{\link{ergm}} and -#' \code{\link{simulate.ergm}}) to fit models from this family, as well as -#' statistics specific to modeling counts, such as the [`CMP`][CMP-ergmTerm] for -#' the Conway-Maxwell-Poisson Distribution. #' #' For detailed information on how to download and install the software, go to #' the Statnet project website: \url{https://statnet.org}. A tutorial, support @@ -54,29 +51,13 @@ #' no way to detect when a parameter configuration had strayed outside of the #' parameter space, but it may be noticeable on a runtime trace plot (activated #' via `MCMC.runtime.traceplot` control parameter), when the simulated -#' values keep climbing upwards. (See Krivitsky (2012) for a further +#' values keep climbing upwards. (See \insertCite{Kr12e;textual}{ergm.count} for a further #' discussion.) #' -#' A possible remedy if this appears to occur is to try lowering the control -#' parameter `MCMLE.steplength`. +#' A possible remedy if this appears to occur is to try lowering the +#' [control.ergm()] parameter `MCMLE.steplength`. #' #' @name ergm.count-package -#' @docType package -#' @author Pavel N. Krivitsky \email{pavel@@statnet.org} #' @seealso [`ergmTerm`], [`ergmReference`] -#' @references Handcock MS, Hunter DR, Butts CT, Goodreau SG, Krivitsky PN and -#' Morris M (2012). _Fit, Simulate and Diagnose Exponential-Family Models for -#' Networks_. Version 3.1. Project home page at , -#' . -#' -#' Krivitsky PN (2012). Exponential-Family Random Graph Models for Valued -#' Networks. \emph{Electronic Journal of Statistics}, 2012, 6, 1100-1128. -#' \doi{10.1214/12-EJS696} -#' -#' Shmueli G, Minka TP, Kadane JB, Borle S, and Boatwright P (2005). A -#' Useful Distribution for Fitting Discrete Data: Revival of the -#' Conway--Maxwell--Poisson Distribution. *Journal of the Royal -#' Statistical Society: Series C*, 54(1): 127-142. -#' -#' @keywords package models -NULL +#' @references \insertAllCited{} +"_PACKAGE" diff --git a/R/zzz.R b/R/zzz.R index 5972410..da3e606 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -5,10 +5,11 @@ # open source, and has the attribution requirements (GPL Section 7) at # https://statnet.org/attribution . # -# Copyright 2008-2022 Statnet Commons +# Copyright 2008-2024 Statnet Commons ################################################################################ #' @import statnet.common network ergm #' @useDynLib ergm.count +#' @importFrom Rdpack reprompt .onAttach <- function(libname, pkgname){ sm <- statnetStartupMessage("ergm.count",c("statnet"),FALSE) if(!is.null(sm)){ diff --git a/inst/CITATION b/inst/CITATION index a2d176b..1873a51 100644 --- a/inst/CITATION +++ b/inst/CITATION @@ -8,48 +8,57 @@ citHeader(paste0(sQuote("ergm.count"), " is part of the Statnet suite of package # ---- END AUTOGENERATED STATNET CITATION ---- #' statnet: statnet.cite.pkg("ergm.count") # ---- BEGIN AUTOGENERATED STATNET CITATION ---- -bibentry("Manual", author = structure(list(list(given = "Pavel N.", - family = "Krivitsky", role = c("aut", "cre"), email = "pavel@statnet.org", +bibentry("Manual", author = structure(list(list(given = c("Pavel", +"N."), family = "Krivitsky", role = c("aut", "cre"), email = "pavel@statnet.org", comment = c(ORCID = "0000-0002-9101-3362"))), class = "person"), title = paste("ergm.count", ": ", gsub("\n", " ", "Fit, Simulate and Diagnose Exponential-Family Models for Networks with Count Edges", fixed = TRUE), sep = ""), organization = paste0("The Statnet Project (\\url{", - "https://statnet.org", "})"), year = substr("2022-05-24", - 1, 4), note = paste("R package version ", "4.1.1", sep = ""), + "https://statnet.org", "})"), year = substr("2024-06-15", + 1, 4), note = paste("R package version ", "4.1.2", sep = ""), url = paste0("https://CRAN.R-project.org/package=", "ergm.count")) # ---- END AUTOGENERATED STATNET CITATION ---- #' statnet: statnet.cite.pkg("ergm") # ---- BEGIN AUTOGENERATED STATNET CITATION ---- -bibentry("Manual", author = structure(list(list(given = "Mark S.", - family = "Handcock", role = "aut", email = "handcock@stat.ucla.edu", - comment = NULL), list(given = "David R.", family = "Hunter", +bibentry("Manual", author = structure(list(list(given = c("Mark", +"S."), family = "Handcock", role = "aut", email = "handcock@stat.ucla.edu", + comment = NULL), list(given = c("David", "R."), family = "Hunter", role = "aut", email = "dhunter@stat.psu.edu", comment = NULL), - list(given = "Carter T.", family = "Butts", role = "aut", - email = "buttsc@uci.edu", comment = NULL), list(given = "Steven M.", - family = "Goodreau", role = "aut", email = "goodreau@u.washington.edu", - comment = NULL), list(given = "Pavel N.", family = "Krivitsky", + list(given = c("Carter", "T."), family = "Butts", role = "aut", + email = "buttsc@uci.edu", comment = NULL), list(given = c("Steven", + "M."), family = "Goodreau", role = "aut", email = "goodreau@u.washington.edu", + comment = NULL), list(given = c("Pavel", "N."), family = "Krivitsky", role = c("aut", "cre"), email = "pavel@statnet.org", comment = c(ORCID = "0000-0002-9101-3362")), list(given = "Martina", family = "Morris", role = "aut", email = "morrism@u.washington.edu", comment = NULL)), class = "person"), title = paste("ergm", ": ", gsub("\n", " ", "Fit, Simulate and Diagnose Exponential-Family Models for Networks", fixed = TRUE), sep = ""), organization = paste0("The Statnet Project (\\url{", - "https://statnet.org", "})"), year = substr("2022-05-24", - 1, 4), note = paste("R package version ", "4.2-6918", sep = ""), + "https://statnet.org", "})"), year = substr("2024-06-11", + 1, 4), note = paste("R package version ", "4.7-7368", sep = ""), url = paste0("https://CRAN.R-project.org/package=", "ergm")) # ---- END AUTOGENERATED STATNET CITATION ---- -bibentry("Misc", - title = "ergm 4.0: New features and improvements", - author = personList(person("Pavel N.", "Krivitsky"), - person("David R.", "Hunter"), - person("Martina", "Morris"), - person("Chad", "Klumb")), - eprint = "arXiv:2106.04997", - year = 2021) +bibentry(bibtype = "Article", + title = "{ergm} 4: New Features for Analyzing Exponential-Family Random Graph Models", + author = c(person(given = c("Pavel", "N."), + family = "Krivitsky"), + person(given = c("David", "R."), + family = "Hunter"), + person(given = "Martina", + family = "Morris"), + person(given = "Chad", + family = "Klumb")), + journal = "Journal of Statistical Software", + year = "2023", + volume = "105", + number = "6", + pages = "1--44", + doi = "10.18637/jss.v105.i06" +) bibentry("Article", title = "Exponential-family random graph models for valued networks", - author = personList(person("Pavel N.", "Krivitsky")), + author = c(person("Pavel N.", "Krivitsky")), doi = "10.1214/12-EJS696", journal = "Electronic Journal of Statistics", year = 2012, volume = 6, pages = "1100-1128") diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd index 550b3c2..a9b4316 100644 --- a/inst/NEWS.Rd +++ b/inst/NEWS.Rd @@ -5,7 +5,7 @@ % open source, and has the attribution requirements (GPL Section 7) at % https://statnet.org/attribution . % -% Copyright 2008-2022 Statnet Commons +% Copyright 2008-2024 Statnet Commons %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \name{NEWS} \title{NEWS file for the \code{\link[=ergm.count-package]{ergm.count}} package} @@ -65,6 +65,20 @@ %% } + +\section{Changes in version 4.1.2}{ + \subsection{BUG FIXES}{ + \itemize{ + \item{ + \item A number of fixes and corrections to package documentation. + } + } + } +} + + + + \section{Changes in version 4.1.1}{ \subsection{NEW FEATURES}{ diff --git a/inst/REFERENCES.bib b/inst/REFERENCES.bib new file mode 100644 index 0000000..8f061ff --- /dev/null +++ b/inst/REFERENCES.bib @@ -0,0 +1,249 @@ +% Encoding: ISO-8859-1 + +@Article{KrHu23e, + author = {Pavel N. Krivitsky and David R. Hunter and Martina Morris and Chad Klumb}, + title = {{ergm} 4: New Features for Analyzing Exponential-Family Random Graph Models}, + journal = {Journal of Statistical Software}, + year = {2023}, + volume = {105}, + number = {6}, + pages = {1--44}, + doi = {10.18637/jss.v105.i06}, +} + +@Article{HuHa08e, + author = {Hunter, David R. and Handcock, Mark S. and Butts, Carter T. and Goodreau, Steven M. and Morris, Martina}, + title = {{ergm}: A Package to Fit, Simulate and Diagnose Exponential-Family Models for Networks}, + journal = {Journal of Statistical Software}, + year = {2008}, + volume = {24}, + number = {3}, + pages = {1--29}, + month = may, + doi = {10.18637/jss.v024.i03}, +} + +@Article{DuGi09f, + author = {van Duijn, Marijtje A. J. and Gile, Krista J. and Handcock, Mark S.}, + title = {A Framework for the Comparison of Maximum Pseudo-likelihood and Maximum Likelihood Estimation of Exponential Family Random Graph Models}, + journal = {Social Networks}, + year = {2009}, + volume = {31}, + number = {1}, + pages = {52--62}, + doi = {10.1016/j.socnet.2008.10.003}, +} + +@InProceedings{ScDe17e, + author = {Schmid, Christian S and Desmarais, Bruce A}, + title = {Exponential random graph models with big networks: Maximum pseudolikelihood estimation and the parametric bootstrap}, + booktitle = {2017 IEEE international conference on big data (Big Data)}, + year = {2017}, + pages = {116--121}, + organization = {IEEE}, +} + +@Article{ScHu23c, + author = {Christian S. Schmid and David R. Hunter}, + title = {Computing Pseudolikelihood Estimators for Exponential-Family Random Graph Models}, + journal = {Journal of Data Science}, + volume = {21}, + number = {2}, + year = {2023}, + pages = {295--309}, + doi = {10.6339/23-JDS1094}, +} + +@Article{HuHu12i, + author = {Hummel, Ruth M. and Hunter, David R. and Handcock, Mark S.}, + title = {Improving Simulation-based Algorithms for Fitting {ERGMs}}, + journal = {Journal of Computational and Graphical Statistics}, + year = {2012}, + volume = {21}, + number = {4}, + pages = {920--939}, + abstract = { Markov chain Monte Carlo methods can be used to approximate the intractable normalizing constants that arise in likelihood calculations for many exponential-family random graph models for networks. However, in practice, the resulting approximations degrade as parameter values move away from the value used to define the Markov chain, even in cases where the chain produces perfectly efficient samples. We introduce a new approximation method along with a novel method of moving toward a maximum likelihood estimator (MLE) from an arbitrary starting parameter value in a series of steps based on alternating between the canonical exponential-family parameterization and the mean-value parameterization. This technique enables us to find an approximate MLE in many cases where this was previously not possible. We illustrate these methods on a model for a transcriptional regulation network for E. coli, an example where previous attempts to approximate an MLE had failed, and a model for a well-known social network dataset involving friendships among workers in a tailor shop. These methods are implemented in the publicly available ergm package for R, and computer code to duplicate the results of this article is included in the online supplementary materials. }, + doi = {10.1080/10618600.2012.679224}, + file = {HuHu12i.pdf:/home/pavel/Documents/Research/References/HuHu12i.pdf:PDF}, +} + +@Article{HaGi10m, + author = {Handcock, Mark S. and Gile, Krista J.}, + title = {Modeling Social Networks from Sampled Data}, + journal = {Annals of Applied Statistics}, + year = {2010}, + volume = {4}, + number = {1}, + pages = {5--25}, + issn = {1932-6157}, + abstract = {Network models are widely used to represent relational information among interacting units and the structural implications of these relations. Recently, social network studies have focused a great deal of attention on random graph models of networks whose nodes represent individual social actors and whose edges represent a specified relationship between the actors. Most inference for social network models assumes that the presence or absence of all possible links is observed, that the information is completely reliable, and that there are no measurement (e.g., recording) errors. This is clearly not true in practice, as much network data is collected though sample surveys. In addition even if a census of a population is attempted, individuals and links between individuals are missed (i.e., do not appear in the recorded data). In this paper we develop the conceptual and computational theory for inference based on sampled network information. We first review forms of network sampling designs used in practice. We consider inference from the likelihood framework, and develop a typology of network data that reflects their treatment within this frame. We then develop inference for social network models based on information from adaptive network designs. We motivate and illustrate these ideas by analyzing the effect of link-tracing sampling designs on a collaboration network.}, + doi = {10.1214/08-AOAS221}, + file = {:HaGi10m.pdf:PDF}, +} + +@Article{HuHa06i, + author = {Hunter, David R. and Handcock, Mark S.}, + title = {Inference in Curved Exponential Family Models for Networks}, + journal = {Journal of Computational and Graphical Statistics}, + year = {2006}, + volume = {15}, + number = {3}, + pages = {565--583}, + issn = {1061-8600}, + doi = {10.1198/106186006X133069}, + file = {:HuHa06i.pdf:PDF}, + publisher = {American Statistical Association}, +} + +@Article{Sn02m, + author = {Snijders, Tom A. B.}, + title = {{Markov chain Monte Carlo} Estimation of Exponential Random Graph Models}, + journal = {Journal of Social Structure}, + year = {2002}, + volume = {3}, + number = {2}, + file = {:Sn02m.pdf:PDF}, +} + +@Article{StIk90p, + author = {Strauss, David and Ikeda, Michael}, + title = {Pseudolikelihood Estimation for Social Networks}, + journal = {Journal of the American Statistical Association}, + year = {1990}, + volume = {85}, + number = {409}, + pages = {204--212}, + issn = {0162-1459}, +} + +@Article{RoMo51s, + author = {Robbins, Herbert and Monro, Sutton}, + title = {A Stochastic Approximation Method}, + journal = {The Annals of Mathematical Statistics}, + year = {1951}, + volume = {22}, + number = {3}, + pages = {400--407}, + month = sep, + issn = {00034851}, + abstract = {Let M(x) denote the expected value at level x of the response to a certain experiment. M(x) is assumed to be a monotone function of x but is unknown to the experimenter, and it is desired to find the solution x = θ of the equation M(x) = α, where α is a given constant. We give a method for making successive experiments at levels x1,x2,⋯ in such a way that xn will tend to θ in probability.}, + copyright = {Copyright © 1951 Institute of Mathematical Statistics}, + file = {:RoMo51s.pdf:PDF}, + publisher = {Institute of Mathematical Statistics}, +} + +@Article{Be74s, + author = {Besag, Julian}, + title = {Spatial Interaction and the Statistical Analysis of Lattice Systems (with Discussion)}, + journal = {Journal of the Royal Statistical Society, Series B}, + year = {1974}, + volume = {36}, + pages = {192--236}, + issn = {0035-9246}, + date-modified = {2007-03-13 22:41:28 -0700}, +} + +@Article{FrSt86m, + author = {Frank, Ove and Strauss, David}, + title = {{Markov} Graphs}, + journal = {Journal of the American Statistical Association}, + year = {1986}, + volume = {81}, + number = {395}, + pages = {832--842}, + issn = {0162-1459}, + doi = {10.1080/01621459.1986.10478342}, + file = {:FrSt86m.pdf:PDF}, +} + +@Article{Kr17u, + author = {Pavel N. Krivitsky}, + title = {Using Contrastive Divergence to Seed {Monte} {Carlo} {MLE} for Exponential-family Random Graph Models}, + journal = {Computational Statistics \& Data Analysis}, + year = {2017}, + volume = {107}, + pages = {149--161}, + month = mar, + doi = {10.1016/j.csda.2016.10.015}, + file = {Kr17u.pdf:Mine/Kr17u.pdf:PDF}, +} + +@Article{KrKu23l, + author = {Krivitsky, Pavel N. and Kuvelkar, Alina R. and Hunter, David R.}, + title = {Likelihood-based Inference for Exponential-Family Random Graph Models via Linear Programming}, + journal = {Electronic Journal of Statistics}, + year = {2023}, + volume = {17}, + number = {2}, + month = jan, + issn = {1935-7524}, + doi = {10.1214/23-ejs2176}, + publisher = {Institute of Mathematical Statistics}, +} + +@article{VaFl15m, + author = {Vats, Dootika and Flegal, James M. and Jones, Galin L.}, + title = {Multivariate output analysis for {Markov} chain {Monte} {Carlo}}, + journal = {Biometrika}, + volume = {106}, + number = {2}, + pages = {321-337}, + year = {2019}, + month = {04}, + abstract = {Markov chain Monte Carlo produces a correlated sample which may be used for estimating expectations with respect to a target distribution. A fundamental question is: when should sampling stop so that we have good estimates of the desired quantities? The key to answering this question lies in assessing the Monte Carlo error through a multivariate Markov chain central limit theorem. The multivariate nature of this Monte Carlo error has been largely ignored in the literature. We present a multivariate framework for terminating a simulation in Markov chain Monte Carlo. We define a multivariate effective sample size, the estimation of which requires strongly consistent estimators of the covariance matrix in the Markov chain central limit theorem, a property we show for the multivariate batch means estimator. We then provide a lower bound on the number of minimum effective samples required for a desired level of precision. This lower bound does not depend on the underlying stochastic process and can be calculated a priori. This result is obtained by drawing a connection between terminating simulation via effective sample size and terminating simulation using a relative standard deviation fixed-volume sequential stopping rule, which we demonstrate is an asymptotically valid procedure. The finite-sample properties of the proposed method are demonstrated in a variety of examples.}, + doi = {10.1093/biomet/asz002}, +} + +@Article{WaAt13a, + author = {Wang, Jing and Atchad\'{e}, Yves F.}, + title = {Approximate Bayesian Computation for Exponential Random Graph Models for Large Social Networks}, + journal = {Communications in Statistics - Simulation and Computation}, + year = {2013}, + volume = {43}, + number = {2}, + pages = {359--377}, + month = sep, + issn = {1532-4141}, + doi = {10.1080/03610918.2012.703359}, + publisher = {Informa UK Limited}, +} + +@Article{Kr12e, + author = {Krivitsky, Pavel N.}, + title = {Exponential-family Random Graph Models for Valued Networks}, + journal = {Electronic Journal of Statistics}, + year = {2012}, + volume = {6}, + pages = {1100--1128}, + abstract = {Exponential-family random graph models (ERGMs) provide a principled and flexible way to model and simulate features common in social networks, such as propensities for homophily, mutuality, and friend-of-a-friend triad closure, through choice of model terms (sufficient statistics). However, those ERGMs modeling the more complex features have, to date, been limited to binary data: presence or absence of ties. Thus, analysis of valued networks, such as those where counts, measurements, or ranks are observed, has necessitated dichotomizing them, losing information and introducing biases. In this work, we generalize ERGMs to valued networks. Focusing on modeling counts, we formulate an ERGM for networks whose ties are counts and discuss issues that arise when moving beyond the binary case. We introduce model terms that generalize and model common social network features for such data and apply these methods to a network dataset whose values are counts of interactions.}, + doi = {10.1214/12-EJS696}, +} + +@Article{KrBu17e, + author = {Krivitsky, Pavel N. and Butts, Carter T.}, + title = {Exponential-family Random Graph Models for Rank-order Relational Data}, + journal = {Sociological Methodology}, + year = {2017}, + volume = {47}, + number = {1}, + pages = {68--112}, + doi = {10.1177/0081175017692623}, + file = {:KrBu12e.pdf:PDF}, +} + +@Article{ShMi05u, + author = {Shmueli, Galit and Minka, Thomas P. and Kadane, Joseph B. and Borle, Sharad and Boatwright, Peter}, + title = {A Useful Distribution for Fitting Discrete Data: Revival of the {Conway--Maxwell--Poisson} Distribution}, + journal = {Journal of the Royal Statistical Society: Series C}, + year = {2005}, + volume = {54}, + number = {1}, + pages = {127--142}, + month = jan, + issn = {1467-9876}, + abstract = {A useful discrete distribution (the Conway–Maxwell–Poisson distribution) is revived and its statistical and probabilistic properties are introduced and explored. This distribution is a two-parameter extension of the Poisson distribution that generalizes some well-known discrete distributions (Poisson, Bernoulli and geometric). It also leads to the generalization of distributions derived from these discrete distributions (i.e. the binomial and negative binomial distributions). We describe three methods for estimating the parameters of the Conway–Maxwell–Poisson distribution. The first is a fast simple weighted least squares method, which leads to estimates that are sufficiently accurate for practical purposes. The second method, using maximum likelihood, can be used to refine the initial estimates. This method requires iterations and is more computationally intensive. The third estimation method is Bayesian. Using the conjugate prior, the posterior density of the parameters of the Conway–Maxwell–Poisson distribution is easily computed. It is a flexible distribution that can account for overdispersion or underdispersion that is commonly encountered in count data. We also explore two sets of real world data demonstrating the flexibility and elegance of the Conway–Maxwell–Poisson distribution in fitting count data which do not seem to follow the Poisson distribution.}, + doi = {10.1111/j.1467-9876.2005.00474.x}, + file = {:ShMi05u.pdf:PDF}, +} + +@Comment{jabref-meta: databaseType:bibtex;} diff --git a/man-roxygen/ergmProposal-general.R b/man-roxygen/ergmProposal-general.R index a791b00..a330167 100644 --- a/man-roxygen/ergmProposal-general.R +++ b/man-roxygen/ergmProposal-general.R @@ -5,10 +5,16 @@ # open source, and has the attribution requirements (GPL Section 7) at # https://statnet.org/attribution . # -# Copyright 2008-2022 Statnet Commons +# Copyright 2008-2024 Statnet Commons ################################################################################ +#' <% name <- if(startsWith(name, "'")) substr(name, 2, 1000) else name %> #' @name <%= name %>-ergmProposal +#' @rdname <%= ergm:::.term.rdname("ergmProposal", name) %> #' @details #' \if{html}{\Sexpr[results=rd,stage=render]{ergm:::.formatProposalsHtml(ergm:::.buildProposalsList(proposal="<%= name %>"))}} #' \if{text}{\Sexpr[results=rd,stage=render]{ergm:::.formatProposalsText(ergm:::.buildProposalsList(proposal="<%= name %>"))}} #' \if{latex}{\Sexpr[results=rd,stage=render]{ergm:::.formatProposalsLatex(ergm:::.buildProposalsList(proposal="<%= name %>"))}} +#' @keywords internal +#' @seealso [`ergmProposal`] for index of proposals currently visible to the package. +#' +#' \Sexpr[results=rd,stage=render]{ergm:::.formatTermKeywords("ergmProposal", "<%= name %>", "subsection")} diff --git a/man-roxygen/ergmReference-general.R b/man-roxygen/ergmReference-general.R index a36662b..f27ca9b 100644 --- a/man-roxygen/ergmReference-general.R +++ b/man-roxygen/ergmReference-general.R @@ -5,7 +5,11 @@ # open source, and has the attribution requirements (GPL Section 7) at # https://statnet.org/attribution . # -# Copyright 2008-2022 Statnet Commons +# Copyright 2008-2024 Statnet Commons ################################################################################ +#' <% name <- if(startsWith(name, "'")) substr(name, 2, 1000) else name %> #' @name <%= name %>-ergmReference +#' @rdname <%= ergm:::.term.rdname("ergmReference", name) %> #' @seealso [`ergmReference`] for index of reference distributions currently visible to the package. +#' +#' \Sexpr[results=rd,stage=render]{ergm:::.formatTermKeywords("ergmReference", "<%= name %>", "subsection")} diff --git a/man-roxygen/ergmTerm-general.R b/man-roxygen/ergmTerm-general.R index 8c2a885..e42cf06 100644 --- a/man-roxygen/ergmTerm-general.R +++ b/man-roxygen/ergmTerm-general.R @@ -5,7 +5,11 @@ # open source, and has the attribution requirements (GPL Section 7) at # https://statnet.org/attribution . # -# Copyright 2008-2022 Statnet Commons +# Copyright 2008-2024 Statnet Commons ################################################################################ +#' <% name <- if(startsWith(name, "'")) substr(name, 2, 1000) else name %> #' @name <%= name %>-ergmTerm - +#' @rdname <%= ergm:::.term.rdname("ergmTerm", name) %> +#' @seealso [`ergmTerm`] for index of model terms currently visible to the package. +#' +#' \Sexpr[results=rd,stage=render]{ergm:::.formatTermKeywords("ergmTerm", "<%= name %>", "subsection")} diff --git a/man/Binomial-ergmReference.Rd b/man/Binomial-ergmReference-cdff43a4.Rd similarity index 89% rename from man/Binomial-ergmReference.Rd rename to man/Binomial-ergmReference-cdff43a4.Rd index fecf09e..6132dc3 100644 --- a/man/Binomial-ergmReference.Rd +++ b/man/Binomial-ergmReference-cdff43a4.Rd @@ -21,6 +21,8 @@ regression. } \seealso{ \code{\link{ergmReference}} for index of reference distributions currently visible to the package. + +\Sexpr[results=rd,stage=render]{ergm:::.formatTermKeywords("ergmReference", "Binomial", "subsection")} } \concept{bipartite} \concept{directed} diff --git a/man/CMB-ergmTerm.Rd b/man/CMB-ergmTerm-5a51afe9.Rd similarity index 84% rename from man/CMB-ergmTerm.Rd rename to man/CMB-ergmTerm-5a51afe9.Rd index 68ccd3b..5b29892 100644 --- a/man/CMB-ergmTerm.Rd +++ b/man/CMB-ergmTerm-5a51afe9.Rd @@ -25,6 +25,11 @@ positive coefficient induces overdispersion. If \code{coupled==FALSE} the two summands above are added as their own statistic (each with its own free parameter). } +\seealso{ +\code{\link{ergmTerm}} for index of model terms currently visible to the package. + +\Sexpr[results=rd,stage=render]{ergm:::.formatTermKeywords("ergmTerm", "CMB", "subsection")} +} \concept{directed} \concept{nonnegative} \concept{undirected} diff --git a/man/CMP-ergmTerm.Rd b/man/CMP-ergmTerm-4d501174.Rd similarity index 83% rename from man/CMP-ergmTerm.Rd rename to man/CMP-ergmTerm-4d501174.Rd index b5458de..3bedb8b 100644 --- a/man/CMP-ergmTerm.Rd +++ b/man/CMP-ergmTerm-4d501174.Rd @@ -21,6 +21,11 @@ different from 3.1.1, when the negation of this value was used.) Note that its current implementation may not perform well if the data are overdispersed relative to geometric. } +\seealso{ +\code{\link{ergmTerm}} for index of model terms currently visible to the package. + +\Sexpr[results=rd,stage=render]{ergm:::.formatTermKeywords("ergmTerm", "CMP", "subsection")} +} \concept{directed} \concept{nonnegative} \concept{undirected} diff --git a/man/Disc-ergmProposal.Rd b/man/Disc-ergmProposal-b6c6e5ca.Rd similarity index 82% rename from man/Disc-ergmProposal.Rd rename to man/Disc-ergmProposal-b6c6e5ca.Rd index 5d5a300..784e4bb 100644 --- a/man/Disc-ergmProposal.Rd +++ b/man/Disc-ergmProposal-b6c6e5ca.Rd @@ -15,6 +15,10 @@ This proposal implements \link{Poisson-ergmReference}, \if{latex}{\Sexpr[results=rd,stage=render]{ergm:::.formatProposalsLatex(ergm:::.buildProposalsList(proposal="Disc"))}} } \seealso{ +\code{\link{ergmProposal}} for index of proposals currently visible to the package. + +\Sexpr[results=rd,stage=render]{ergm:::.formatTermKeywords("ergmProposal", "Disc", "subsection")} + \link{DiscTNT-ergmProposal} } \concept{bipartite} @@ -22,3 +26,4 @@ This proposal implements \link{Poisson-ergmReference}, \concept{discrete} \concept{undirected} \concept{valued} +\keyword{internal} diff --git a/man/DiscTNT-ergmProposal.Rd b/man/DiscTNT-ergmProposal-c3c2e8cb.Rd similarity index 83% rename from man/DiscTNT-ergmProposal.Rd rename to man/DiscTNT-ergmProposal-c3c2e8cb.Rd index cd4684a..35de59d 100644 --- a/man/DiscTNT-ergmProposal.Rd +++ b/man/DiscTNT-ergmProposal-c3c2e8cb.Rd @@ -17,6 +17,10 @@ dyad-level constraints. \if{latex}{\Sexpr[results=rd,stage=render]{ergm:::.formatProposalsLatex(ergm:::.buildProposalsList(proposal="DiscTNT"))}} } \seealso{ +\code{\link{ergmProposal}} for index of proposals currently visible to the package. + +\Sexpr[results=rd,stage=render]{ergm:::.formatTermKeywords("ergmProposal", "DiscTNT", "subsection")} + \link{TNT-ergmProposal} } \concept{bipartite} @@ -24,3 +28,4 @@ dyad-level constraints. \concept{discrete} \concept{undirected} \concept{valued} +\keyword{internal} diff --git a/man/Geometric-ergmReference.Rd b/man/Geometric-ergmReference-1ee5c5ac.Rd similarity index 90% rename from man/Geometric-ergmReference.Rd rename to man/Geometric-ergmReference-1ee5c5ac.Rd index f3380a5..55cb15e 100644 --- a/man/Geometric-ergmReference.Rd +++ b/man/Geometric-ergmReference-1ee5c5ac.Rd @@ -21,6 +21,8 @@ coefficient is \eqn{0} and Poisson when its coefficient is } \seealso{ \code{\link{ergmReference}} for index of reference distributions currently visible to the package. + +\Sexpr[results=rd,stage=render]{ergm:::.formatTermKeywords("ergmReference", "Geometric", "subsection")} } \concept{bipartite} \concept{directed} diff --git a/man/Poisson-ergmReference.Rd b/man/Poisson-ergmReference-40df5ec8.Rd similarity index 95% rename from man/Poisson-ergmReference.Rd rename to man/Poisson-ergmReference-40df5ec8.Rd index 6ff413f..ba11f2d 100644 --- a/man/Poisson-ergmReference.Rd +++ b/man/Poisson-ergmReference-40df5ec8.Rd @@ -47,6 +47,8 @@ the binary TNT. Currently, \code{p0} defaults to 0.2. } \seealso{ \code{\link{ergmReference}} for index of reference distributions currently visible to the package. + +\Sexpr[results=rd,stage=render]{ergm:::.formatTermKeywords("ergmReference", "Poisson", "subsection")} } \concept{bipartite} \concept{directed} diff --git a/man/ZIPoisson-ergmProposal.Rd b/man/ZIPoisson-ergmProposal-bba55a81.Rd similarity index 76% rename from man/ZIPoisson-ergmProposal.Rd rename to man/ZIPoisson-ergmProposal-bba55a81.Rd index fb12da4..de70073 100644 --- a/man/ZIPoisson-ergmProposal.Rd +++ b/man/ZIPoisson-ergmProposal-bba55a81.Rd @@ -12,9 +12,15 @@ TODO \if{text}{\Sexpr[results=rd,stage=render]{ergm:::.formatProposalsText(ergm:::.buildProposalsList(proposal="ZIPoisson"))}} \if{latex}{\Sexpr[results=rd,stage=render]{ergm:::.formatProposalsLatex(ergm:::.buildProposalsList(proposal="ZIPoisson"))}} } +\seealso{ +\code{\link{ergmProposal}} for index of proposals currently visible to the package. + +\Sexpr[results=rd,stage=render]{ergm:::.formatTermKeywords("ergmProposal", "ZIPoisson", "subsection")} +} \concept{bipartite} \concept{directed} \concept{discrete} \concept{nonnegative} \concept{undirected} \concept{valued} +\keyword{internal} diff --git a/man/ergm.count-package.Rd b/man/ergm.count-package.Rd index 40781d1..e4f9b11 100644 --- a/man/ergm.count-package.Rd +++ b/man/ergm.count-package.Rd @@ -2,6 +2,7 @@ % Please edit documentation in R/ergm.count-package.R \docType{package} \name{ergm.count-package} +\alias{ergm.count} \alias{ergm.count-package} \title{Fit, Simulate and Diagnose Exponential-Family Models for Networks with Count Edges} @@ -9,14 +10,16 @@ Edges} \code{\link[=ergm.count-package]{ergm.count}} is a set of extensions to package \code{\link[=ergm-package]{ergm}} to fit and simulate from exponential-family random graph models for networks whose edge weights are -counts. For a list of functions type \code{help(package='ergm')} and -\code{help(package='ergm.count')} +counts \insertCite{Kr12e}{ergm.count}. } \details{ -Mainly, it implements Poisson, binomial, geometric, and discrete uniform -dyadwise reference measures for valued ERGMs -(documented here in \code{\link{ergmReference}}), and provides some count-specific -change statistics (documented in \code{\link{ergmTerm}}). +Mainly, it implements Poisson, binomial, geometric, and discrete +uniform dyadwise reference measures for valued ERGMs (documented +here in \code{\link{ergmReference}}), and provides some count-specific change +statistics (documented in \code{\link{ergmTerm}}) +\insertCite{Kr12e,KrHu23e}{ergm.count}, including +\code{\link[=CMP-ergmTerm]{CMP}} for the Conway--Maxwell--Poisson Distribution +\insertCite{ShMi05u}{ergm.count}. For a complete list of the functions, use \code{library(help="ergm")} and \code{library(help="ergm.count")} or read the rest of the manual. @@ -30,13 +33,6 @@ This package contains functions specific to using \code{\link{ergm}} to model networks whose dyad values are counts. Examples include counts of conversations, messages, and other interactions. -In particular, this package implements the Poisson, geometric, binomial, and -discrete uniform reference measures (documented in -\code{\link{ergmReference}} for use by \code{\link{ergm}} and -\code{\link{simulate.ergm}}) to fit models from this family, as well as -statistics specific to modeling counts, such as the \code{\link[=CMP-ergmTerm]{CMP}} for -the Conway-Maxwell-Poisson Distribution. - For detailed information on how to download and install the software, go to the Statnet project website: \url{https://statnet.org}. A tutorial, support newsgroup, references and links to further resources are provided there. @@ -51,34 +47,28 @@ depend on the terms used in the model. At this time \code{\link{ergm}} has no way to detect when a parameter configuration had strayed outside of the parameter space, but it may be noticeable on a runtime trace plot (activated via \code{MCMC.runtime.traceplot} control parameter), when the simulated -values keep climbing upwards. (See Krivitsky (2012) for a further +values keep climbing upwards. (See \insertCite{Kr12e;textual}{ergm.count} for a further discussion.) -A possible remedy if this appears to occur is to try lowering the control -parameter \code{MCMLE.steplength}. +A possible remedy if this appears to occur is to try lowering the +\code{\link[=control.ergm]{control.ergm()}} parameter \code{MCMLE.steplength}. } } \references{ -Handcock MS, Hunter DR, Butts CT, Goodreau SG, Krivitsky PN and -Morris M (2012). \emph{Fit, Simulate and Diagnose Exponential-Family Models for -Networks}. Version 3.1. Project home page at , -. - -Krivitsky PN (2012). Exponential-Family Random Graph Models for Valued -Networks. \emph{Electronic Journal of Statistics}, 2012, 6, 1100-1128. -\doi{10.1214/12-EJS696} - -Shmueli G, Minka TP, Kadane JB, Borle S, and Boatwright P (2005). A -Useful Distribution for Fitting Discrete Data: Revival of the -Conway--Maxwell--Poisson Distribution. \emph{Journal of the Royal -Statistical Society: Series C}, 54(1): 127-142. +\insertAllCited{} } \seealso{ \code{\link{ergmTerm}}, \code{\link{ergmReference}} } \author{ -Pavel N. Krivitsky \email{pavel@statnet.org} +\strong{Maintainer}: Pavel N. Krivitsky \email{pavel@statnet.org} (\href{https://orcid.org/0000-0002-9101-3362}{ORCID}) + +Other contributors: +\itemize{ + \item Mark S. Handcock \email{handcock@stat.ucla.edu} [contributor] + \item David R. Hunter \email{dhunter@stat.psu.edu} [contributor] + \item Joyce Cheng \email{joyce.cheng@student.unsw.edu.au} [contributor] +} + } -\keyword{models} -\keyword{package} diff --git a/src/include_stubs.c b/src/include_stubs.c index e13933e..1ff42d7 100644 --- a/src/include_stubs.c +++ b/src/include_stubs.c @@ -5,6 +5,6 @@ * open source, and has the attribution requirements (GPL Section 7) at * https://statnet.org/attribution . * - * Copyright 2008-2022 Statnet Commons + * Copyright 2008-2024 Statnet Commons */ #include "ergm_stubs.c" diff --git a/src/init.c b/src/init.c index 598d367..baa4cdd 100644 --- a/src/init.c +++ b/src/init.c @@ -5,7 +5,7 @@ * open source, and has the attribution requirements (GPL Section 7) at * https://statnet.org/attribution . * - * Copyright 2008-2022 Statnet Commons + * Copyright 2008-2024 Statnet Commons */ #include // for NULL #include diff --git a/src/wtMHproposals.c b/src/wtMHproposals.c index ed0a18e..b6c4729 100644 --- a/src/wtMHproposals.c +++ b/src/wtMHproposals.c @@ -5,7 +5,7 @@ * open source, and has the attribution requirements (GPL Section 7) at * https://statnet.org/attribution . * - * Copyright 2008-2022 Statnet Commons + * Copyright 2008-2024 Statnet Commons */ #include "ergm_wtMHproposal.h" diff --git a/src/wtchangestats.c b/src/wtchangestats.c index a28db09..ebe5036 100644 --- a/src/wtchangestats.c +++ b/src/wtchangestats.c @@ -5,7 +5,7 @@ * open source, and has the attribution requirements (GPL Section 7) at * https://statnet.org/attribution . * - * Copyright 2008-2022 Statnet Commons + * Copyright 2008-2024 Statnet Commons */ #include "wtchangestats.h" diff --git a/src/wtchangestats.h b/src/wtchangestats.h index 9fe9bc1..7f09012 100644 --- a/src/wtchangestats.h +++ b/src/wtchangestats.h @@ -5,7 +5,7 @@ * open source, and has the attribution requirements (GPL Section 7) at * https://statnet.org/attribution . * - * Copyright 2008-2022 Statnet Commons + * Copyright 2008-2024 Statnet Commons */ #ifndef WTCHANGESTATS_H #define WTCHANGESTATS_H diff --git a/tests/testthat.R b/tests/testthat.R index c2e57b6..0e9772e 100644 --- a/tests/testthat.R +++ b/tests/testthat.R @@ -5,7 +5,7 @@ # open source, and has the attribution requirements (GPL Section 7) at # https://statnet.org/attribution . # -# Copyright 2008-2022 Statnet Commons +# Copyright 2008-2024 Statnet Commons ################################################################################ library(testthat) library(ergm.count) diff --git a/tests/testthat/test-valued-fit.R b/tests/testthat/test-valued-fit.R index cb4d126..bc68a3b 100644 --- a/tests/testthat/test-valued-fit.R +++ b/tests/testthat/test-valued-fit.R @@ -5,7 +5,7 @@ # open source, and has the attribution requirements (GPL Section 7) at # https://statnet.org/attribution . # -# Copyright 2008-2022 Statnet Commons +# Copyright 2008-2024 Statnet Commons ################################################################################ test_that("Poisson-reference ERGM fit", { set.seed(0) diff --git a/tests/testthat/test-valued-sim.R b/tests/testthat/test-valued-sim.R index 8e937b5..cc8be78 100644 --- a/tests/testthat/test-valued-sim.R +++ b/tests/testthat/test-valued-sim.R @@ -5,7 +5,7 @@ # open source, and has the attribution requirements (GPL Section 7) at # https://statnet.org/attribution . # -# Copyright 2008-2022 Statnet Commons +# Copyright 2008-2024 Statnet Commons ################################################################################ testnet3d <- network.initialize(3, directed=TRUE) # 6 dyads testnet3u <- network.initialize(3, directed=FALSE) # 3 dyads diff --git a/vignettes/valued.Rmd b/vignettes/valued.Rmd index 52c6083..e085d5a 100644 --- a/vignettes/valued.Rmd +++ b/vignettes/valued.Rmd @@ -293,7 +293,7 @@ samplk.tot.el <- as.matrix(samplk.tot, attrname="nominations", samplk.tot.el[1:5,] # and an initial empty network. samplk.tot2 <- samplk1 # Copy samplk1 -delete.edges(samplk.tot2, seq_along(samplk.tot2$mel)) # Empty it out +samplk.tot2[,] <- 0 # Empty it out samplk.tot2 #We could also have used network.initialize(18) samplk.tot2[samplk.tot.el[,1:2], names.eval="nominations", add.edges=TRUE] <- @@ -556,7 +556,7 @@ default. Also, note that for valued ERGMs, the "intercept" term is `sum`, not `edges`. ```{r eval=FALSE} -help("ergm-terms") +?ergmTerm ``` has the complete list across all the loaded packages. In particular, the one in package `ergm` has each term be tagged with whether it's binary or valued. @@ -754,11 +754,6 @@ summary(zach~sum+nonzero+nodefactor("leader")+absdiffcat("faction.id")+ nodecovar(center=TRUE,transform="sqrt"), response="contexts") ``` -A few other notes: - -* By default, Poisson-reference ERGMs use a variant of the TNT proposal to make sampling from sparse (or 0-inflated) networks more efficient. There is a tuning parameter - `MCMC.prop.args=list(p0=...)` that can be used to control how much "zero-inflation" there is. It has a sensible default. - Now, for the fit and the diagnostics: ```{r results="hide", fig.show="hide"} zach.pois <-