diff --git a/NAMESPACE b/NAMESPACE index bd3b0687..57602aba 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -264,7 +264,6 @@ export(network.list) export(nparam) export(nthreads) export(nvattr.copy.network) -export(offset.info.formula) export(param_names) export(rank_test.ergm) export(rlebdm) diff --git a/R/InitErgmTerm.R b/R/InitErgmTerm.R index 50b22f0b..622152a3 100644 --- a/R/InitErgmTerm.R +++ b/R/InitErgmTerm.R @@ -23,14 +23,14 @@ # # # C: = -# D: +# D: # # E: # G: # # # H: -# I: +# I: # # K: # L: @@ -40,7 +40,6 @@ # # # O: -# # P: # R: # S: @@ -2290,21 +2289,6 @@ InitErgmTerm.degree1.5<-function (nw, arglist, ...) { } -################################################################################ -#' @include ergm-deprecated.R -#' @describeIn ergm-deprecated Use [`degree1.5`][degree1.5-ergmTerm] instead. -InitErgmTerm.degreepopularity<-function (nw, arglist, ...) { - .Deprecated("degree1.5") - a <- check.ErgmTerm(nw, arglist, directed=FALSE, - varnames = NULL, - vartypes = NULL, - defaultvalues = list(), - required = NULL) - list(name="degreepopularity", coef.names="degreepopularity", - minval=0, maxval=network.dyadcount(nw,FALSE)*sqrt(network.size(nw)-1), conflicts.constraints="degreedist") -} - - ################################################################################ #' @templateVar name density @@ -2891,101 +2875,6 @@ InitErgmTerm.hamming<-function (nw, arglist, ...) { minval = minval, maxval = maxval) } -################################################################################ -#' @rdname ergm-deprecated -#' @aliases hammingmix -InitErgmTerm.hammingmix<-function (nw, arglist, ..., version=packageVersion("ergm")) { - .Deprecate_once(msg="hammingmix() has been deprecated due to disuse.") - if(version <= as.package_version("3.9.4")){ - # There is no reason hammingmix should be directed-only, but for now - # the undirected version does not seem to work properly, so: - a <- check.ErgmTerm(nw, arglist, directed=TRUE, - varnames = c("attrname","x","base","contrast"), - vartypes = c("character","matrix,network","numeric","logical"), - defaultvalues = list(NULL,nw,NULL,FALSE), - required = c(TRUE,FALSE,FALSE,FALSE), - dep.inform = list(FALSE, FALSE, "levels2", FALSE)) - attrarg <- a$attrname - }else{ - # There is no reason hammingmix should be directed-only, but for now - # the undirected version does not seem to work properly, so: - a <- check.ErgmTerm(nw, arglist, directed=TRUE, - varnames = c("attr", "x", "base", "levels", "levels2","contrast"), - vartypes = c(ERGM_VATTR_SPEC, "matrix,network", "numeric", ERGM_LEVELS_SPEC, ERGM_LEVELS_SPEC,"logical"), - defaultvalues = list(NULL,nw,NULL,NULL,NULL,FALSE), - required = c(TRUE,FALSE,FALSE,FALSE,FALSE,FALSE), - dep.inform = list(FALSE, FALSE, "levels2", FALSE, FALSE, FALSE)) - attrarg <- a$attr - } - - x<-a$x - - if (a$contrast) { - ergm_Init_stop("The 'contrast' argument of the hammingmix term is deprecated. Use 'levels2' instead") - } - if(is.network(x)){ - xm<-as.edgelist(x) - x<-paste(quote(x)) - }else if(is.character(x)){ - xm<-get.network.attribute(nw,x) - xm<-as.edgelist(xm) - }else{ - xm<-as.matrix(x) - x<-paste(quote(x)) - } - if (is.null(xm) || ncol(xm)!=2){ - ergm_Init_stop("hammingmix() requires an edgelist") - } - - nodecov <- ergm_get_vattr(attrarg, nw) - attrname <- attr(nodecov, "name") - - u <- ergm_attr_levels(a$levels, nodecov, nw, sort(unique(nodecov))) - namescov <- u - - nr <- length(u) - nc <- length(u) - - levels2.list <- transpose(expand.grid(row = u, col = u, stringsAsFactors=FALSE)) - indices2.grid <- expand.grid(row = 1:nr, col = 1:nc) - - levels2.sel <- if((!hasName(attr(a,"missing"), "levels2") || attr(a,"missing")["levels2"]) && any(NVL(a$base,0)!=0)) levels2.list[-a$base] - else ergm_attr_levels(a$levels2, list(row = nodecov, col = nodecov), nw, levels2.list) - - rows2keep <- match(levels2.sel,levels2.list, NA) - rows2keep <- rows2keep[!is.na(rows2keep)] - - u <- indices2.grid[rows2keep,] - - nodecov.indices <- match(nodecov, namescov, nomatch=length(namescov) + 1) - - coef.names <- paste("hammingmix",attrname, - apply(matrix(namescov[as.matrix(u)],ncol=2),1,paste,collapse="."), - sep=".") - # Number of input parameters before covariates equals twice the number - # of used matrix cells, namely 2*length(uui), - inputs=c(to_ergm_Cdouble(xm, prototype=nw), u[,1], u[,2], nodecov.indices) - attr(inputs, "ParamsBeforeCov") <- nrow(u) - # The emptynwstats code below does not work right for - # undirected networks, mostly since hammingmix doesn't work - # in this case anyway. - nw %v% "_tmp_nodecov" <- as.vector(nodecov) - if(version <= as.package_version("3.9.4")){ - emptynwstats <- summary(nw ~ nodemix("_tmp_nodecov", base=a$base)) - }else{ - nodemix.call <- c(list(as.name("nodemix"),"_tmp_nodecov"), list(base=a$base, levels=a$levels, levels2=a$levels2)[!attr(a,"missing")[c("base","levels","levels2")]]) - nodemix.call <- as.call(nodemix.call) - nodemix.form <- as.formula(call("~", nw, nodemix.call)) - emptynwstats <- summary(nodemix.form) - } - list(name="hammingmix", coef.names=coef.names, inputs=inputs, - emptynwstats=emptynwstats, dependence=FALSE) -} - - - - - #=======================InitErgmTerm functions: I============================# @@ -3074,21 +2963,6 @@ InitErgmTerm.idegree1.5<-function (nw, arglist, ...) { } -################################################################################ -#' @describeIn ergm-deprecated Use [`idegree1.5`][idegree1.5-ergmTerm] instead. -InitErgmTerm.idegreepopularity<-function (nw, arglist, ...) { - .Deprecated("idegree1.5") - a <- check.ErgmTerm(nw, arglist, directed=TRUE, - varnames = NULL, - vartypes = NULL, - defaultvalues = list(), - required = NULL) - list(name="idegreepopularity", coef.names="idegreepopularity", - minval=0, maxval=network.dyadcount(nw,FALSE)*sqrt(network.size(nw)-1), conflicts.constraints="idegreedist") -} - - - ################################################################################ #' @templateVar name intransitive @@ -4528,20 +4402,6 @@ InitErgmTerm.odegree1.5<-function (nw, arglist, ...) { } -################################################################################ -#' @describeIn ergm-deprecated Use [`odegree1.5`][odegree1.5-ergmTerm] instead. -InitErgmTerm.odegreepopularity<-function (nw, arglist, ...) { - .Deprecated("odegree1.5") - a <- check.ErgmTerm(nw, arglist, directed=TRUE, - varnames = NULL, - vartypes = NULL, - defaultvalues = list(), - required = NULL) - list(name="odegreepopularity", coef.names="odegreepopularity", - minval=0, maxval=network.dyadcount(nw,FALSE)*sqrt(network.size(nw)-1), conflicts.constraints="odegreedist") -} - - ################################################################################ #' @templateVar name opentriad diff --git a/R/ergm-defunct.R b/R/ergm-defunct.R index 86195ac6..afd2d81a 100644 --- a/R/ergm-defunct.R +++ b/R/ergm-defunct.R @@ -75,6 +75,14 @@ #' #' as.rlebdm.ergm(...) #' +#' offset.info.formula(...) +#' +#' InitErgmTerm.degreepopularity(...) +#' +#' InitErgmTerm.idegreepopularity(...) +#' +#' InitErgmTerm.odegreepopularity(...) +#' #' @description Functions that have been removed after a period of deprecation. #' @param ... Arguments to defunct functions. #' @details @@ -140,7 +148,13 @@ #' #' `as.rlebdm.ergm()`: no longer used #' -#' @aliases robust.inverse plot.network.ergm ergm.getterms plot.mcmc.list.ergm plot.ergm summary.statistics ergm.checkargs ergm.checkbipartite ergm.checkdirected summary.gof ergm.getMCMCsample ergm.MHP.table MHproposal MHproposal.character MHproposal.ergm MHproposal.formula ergm.init.methods ergm.ConstraintImplications ergm.mcmcslave ergm.update.formula remove.offset.formula network.update ergm.getmodel ergm.getglobalstats as.edgelist.compressed as.network.uncompressed standardize.network newnw.extract san.ergm is.inCH as.rlebdm.ergm +#' `offset.info.formula()`: no longer used +#' +#' `degreepopularity`, `odegreepopularity`, `idegreepopularity`: use the corresponding `degree1.5` term +#' +#' `hammingmix`: use `hamming(...):nodemix(...)` for example +#' +#' @aliases robust.inverse plot.network.ergm ergm.getterms plot.mcmc.list.ergm plot.ergm summary.statistics ergm.checkargs ergm.checkbipartite ergm.checkdirected summary.gof ergm.getMCMCsample ergm.MHP.table MHproposal MHproposal.character MHproposal.ergm MHproposal.formula ergm.init.methods ergm.ConstraintImplications ergm.mcmcslave ergm.update.formula remove.offset.formula network.update ergm.getmodel ergm.getglobalstats as.edgelist.compressed as.network.uncompressed standardize.network newnw.extract san.ergm is.inCH as.rlebdm.ergm degreepopularity-ergmTerm odegreepopularity-ergmTerm idegreepopularity-ergmTerm hammingmix-ergmTerm offset.info.formula #' #' @keywords internal NULL diff --git a/R/formula.utils.R b/R/formula.utils.R index de0fbe65..599f5ee1 100644 --- a/R/formula.utils.R +++ b/R/formula.utils.R @@ -283,13 +283,3 @@ enformulate.curved.formula <- function(object, theta, ...){ model.transform.formula(object, theta, recipes, ...) } - -#' @describeIn ergm-deprecated \code{offset.info.formula} returns the offset -#' vectors associated with a formula. -#' @export offset.info.formula -offset.info.formula <- function(object, ...){ - .Deprecated() - nw <- ergm.getnetwork(object) - m<-ergm_model(object, nw, ...) - with(m$etamap, list(term=offset, theta=offsettheta,eta=offsetmap)) -} diff --git a/man/ergm-defunct.Rd b/man/ergm-defunct.Rd index 288f6397..d264fae9 100644 --- a/man/ergm-defunct.Rd +++ b/man/ergm-defunct.Rd @@ -33,6 +33,11 @@ \alias{san.ergm} \alias{is.inCH} \alias{as.rlebdm.ergm} +\alias{degreepopularity-ergmTerm} +\alias{odegreepopularity-ergmTerm} +\alias{idegreepopularity-ergmTerm} +\alias{hammingmix-ergmTerm} +\alias{offset.info.formula} \title{Functions that have been removed from this package} \usage{ robust.inverse(...) @@ -96,6 +101,14 @@ san.ergm(...) is.inCH(...) as.rlebdm.ergm(...) + +offset.info.formula(...) + +InitErgmTerm.degreepopularity(...) + +InitErgmTerm.idegreepopularity(...) + +InitErgmTerm.odegreepopularity(...) } \arguments{ \item{...}{Arguments to defunct functions.} @@ -165,5 +178,11 @@ Functions that have been removed after a period of deprecation. \code{is.inCH()}: use \code{shrink_into_CH()}. \code{as.rlebdm.ergm()}: no longer used + +\code{offset.info.formula()}: no longer used + +\code{degreepopularity}, \code{odegreepopularity}, \code{idegreepopularity}: use the corresponding \code{degree1.5} term + +\code{hammingmix}: use \code{hamming(...):nodemix(...)} for example } \keyword{internal} diff --git a/man/ergm-deprecated.Rd b/man/ergm-deprecated.Rd index b184b0e9..0f604d19 100644 --- a/man/ergm-deprecated.Rd +++ b/man/ergm-deprecated.Rd @@ -1,17 +1,10 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/ergm-deprecated.R, R/InitErgmTerm.R, -% R/formula.utils.R +% Please edit documentation in R/ergm-deprecated.R \name{ergm-deprecated} \alias{ergm-deprecated} \alias{coef.ergm} \alias{$.ergm} \alias{control.ergm.godfather} -\alias{InitErgmTerm.degreepopularity} -\alias{InitErgmTerm.hammingmix} -\alias{hammingmix} -\alias{InitErgmTerm.idegreepopularity} -\alias{InitErgmTerm.odegreepopularity} -\alias{offset.info.formula} \title{Functions that will no longer be supported in future releases of the package} \usage{ \method{coef}{ergm}(object, ...) @@ -19,16 +12,6 @@ \method{$}{ergm}(x, name) control.ergm.godfather(term.options = NULL) - -InitErgmTerm.degreepopularity(nw, arglist, ...) - -InitErgmTerm.hammingmix(nw, arglist, ..., version = packageVersion("ergm")) - -InitErgmTerm.idegreepopularity(nw, arglist, ...) - -InitErgmTerm.odegreepopularity(nw, arglist, ...) - -offset.info.formula(object, ...) } \arguments{ \item{name}{See \link{Extract}.} @@ -49,15 +32,6 @@ needed for backwards compatibility when components get renamed. \item \code{control.ergm.godfather()}: constructs a control list for \code{\link[=ergm.godfather]{ergm.godfather()}}; not used at this time. -\item \code{InitErgmTerm.degreepopularity()}: Use \code{\link[=degree1.5-ergmTerm]{degree1.5}} instead. - -\item \code{InitErgmTerm.idegreepopularity()}: Use \code{\link[=idegree1.5-ergmTerm]{idegree1.5}} instead. - -\item \code{InitErgmTerm.odegreepopularity()}: Use \code{\link[=odegree1.5-ergmTerm]{odegree1.5}} instead. - -\item \code{offset.info.formula()}: \code{offset.info.formula} returns the offset -vectors associated with a formula. - }} \keyword{internal} \keyword{misc} diff --git a/src/changestats.c b/src/changestats.c index 1dd1e931..b64ed562 100644 --- a/src/changestats.c +++ b/src/changestats.c @@ -2036,31 +2036,6 @@ C_CHANGESTAT_FN(c_hamming) { } -/***************** - changestat: d_hammingmix -*****************/ -C_CHANGESTAT_FN(c_hammingmix) { - - Edge nhedge = INPUT_PARAM[0]; -/* Rprintf("nstats %d nhedge %d i0 %f i1 %f i2 %f i3 %f\n",nstats, nhedge, INPUT_PARAM[0], - INPUT_PARAM[1], - INPUT_PARAM[2], - INPUT_PARAM[3] - ); */ - - - /* *** don't forget tail -> head */ - int matchvaltail = INPUT_PARAM[tail+2*N_CHANGE_STATS+2*nhedge]; - int matchvalhead = INPUT_PARAM[head+2*N_CHANGE_STATS+2*nhedge]; - unsigned int discord = XOR(dEdgeListSearch(tail, head, INPUT_PARAM), edgestate); - for (unsigned int j=0; j