Skip to content

Commit 581f93a

Browse files
committed
Defunct-ed *degreepopularity and hammingmix terms and offset.info.formula() after a long deprecation prediod.
1 parent 0054884 commit 581f93a

File tree

7 files changed

+37
-206
lines changed

7 files changed

+37
-206
lines changed

NAMESPACE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ export(network.list)
264264
export(nparam)
265265
export(nthreads)
266266
export(nvattr.copy.network)
267-
export(offset.info.formula)
268267
export(param_names)
269268
export(rank_test.ergm)
270269
export(rlebdm)

R/InitErgmTerm.R

Lines changed: 2 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323
# <b2star> <b2starmix> <b2twostar>
2424
# <balance>
2525
# C: <concurrent> <cycle> <ctriple>=<ctriad>
26-
# D: <degree> <degreepopularity><density> <dsp>
26+
# D: <degree> <density> <dsp>
2727
# <dyadcov> <degcrossprod> <degcor>
2828
# E: <edgecov> <edges> <esp>
2929
# G: <gwb1degree> <gwb2degree> <gwdegree>
3030
# <gwdsp> <gwesp> <gwidegree>
3131
# <gwnsp> <gwodegree>
3232
# H: <hamming>
33-
# I: <idegree> <intransitive> <idegreepopularity>
33+
# I: <idegree> <intransitive>
3434
# <isolates> <istar>
3535
# K: <kstar>
3636
# L: <localtriangle>
@@ -40,7 +40,6 @@
4040
# <nodemix> <nodeocov> <nodeofactor>
4141
# <nsp>
4242
# O: <odegree> <opentriad> <ostar>
43-
# <odegreepopularity>
4443
# P: <pdegcor>
4544
# R: <receiver> <rdegcor>
4645
# S: <sender> <simmelian> <simmelianties>
@@ -2290,21 +2289,6 @@ InitErgmTerm.degree1.5<-function (nw, arglist, ...) {
22902289
}
22912290

22922291

2293-
################################################################################
2294-
#' @include ergm-deprecated.R
2295-
#' @describeIn ergm-deprecated Use [`degree1.5`][degree1.5-ergmTerm] instead.
2296-
InitErgmTerm.degreepopularity<-function (nw, arglist, ...) {
2297-
.Deprecated("degree1.5")
2298-
a <- check.ErgmTerm(nw, arglist, directed=FALSE,
2299-
varnames = NULL,
2300-
vartypes = NULL,
2301-
defaultvalues = list(),
2302-
required = NULL)
2303-
list(name="degreepopularity", coef.names="degreepopularity",
2304-
minval=0, maxval=network.dyadcount(nw,FALSE)*sqrt(network.size(nw)-1), conflicts.constraints="degreedist")
2305-
}
2306-
2307-
23082292
################################################################################
23092293

23102294
#' @templateVar name density
@@ -2891,101 +2875,6 @@ InitErgmTerm.hamming<-function (nw, arglist, ...) {
28912875
minval = minval, maxval = maxval)
28922876
}
28932877

2894-
################################################################################
2895-
#' @rdname ergm-deprecated
2896-
#' @aliases hammingmix
2897-
InitErgmTerm.hammingmix<-function (nw, arglist, ..., version=packageVersion("ergm")) {
2898-
.Deprecate_once(msg="hammingmix() has been deprecated due to disuse.")
2899-
if(version <= as.package_version("3.9.4")){
2900-
# There is no reason hammingmix should be directed-only, but for now
2901-
# the undirected version does not seem to work properly, so:
2902-
a <- check.ErgmTerm(nw, arglist, directed=TRUE,
2903-
varnames = c("attrname","x","base","contrast"),
2904-
vartypes = c("character","matrix,network","numeric","logical"),
2905-
defaultvalues = list(NULL,nw,NULL,FALSE),
2906-
required = c(TRUE,FALSE,FALSE,FALSE),
2907-
dep.inform = list(FALSE, FALSE, "levels2", FALSE))
2908-
attrarg <- a$attrname
2909-
}else{
2910-
# There is no reason hammingmix should be directed-only, but for now
2911-
# the undirected version does not seem to work properly, so:
2912-
a <- check.ErgmTerm(nw, arglist, directed=TRUE,
2913-
varnames = c("attr", "x", "base", "levels", "levels2","contrast"),
2914-
vartypes = c(ERGM_VATTR_SPEC, "matrix,network", "numeric", ERGM_LEVELS_SPEC, ERGM_LEVELS_SPEC,"logical"),
2915-
defaultvalues = list(NULL,nw,NULL,NULL,NULL,FALSE),
2916-
required = c(TRUE,FALSE,FALSE,FALSE,FALSE,FALSE),
2917-
dep.inform = list(FALSE, FALSE, "levels2", FALSE, FALSE, FALSE))
2918-
attrarg <- a$attr
2919-
}
2920-
2921-
x<-a$x
2922-
2923-
if (a$contrast) {
2924-
ergm_Init_stop("The 'contrast' argument of the hammingmix term is deprecated. Use 'levels2' instead")
2925-
}
2926-
if(is.network(x)){
2927-
xm<-as.edgelist(x)
2928-
x<-paste(quote(x))
2929-
}else if(is.character(x)){
2930-
xm<-get.network.attribute(nw,x)
2931-
xm<-as.edgelist(xm)
2932-
}else{
2933-
xm<-as.matrix(x)
2934-
x<-paste(quote(x))
2935-
}
2936-
if (is.null(xm) || ncol(xm)!=2){
2937-
ergm_Init_stop("hammingmix() requires an edgelist")
2938-
}
2939-
2940-
nodecov <- ergm_get_vattr(attrarg, nw)
2941-
attrname <- attr(nodecov, "name")
2942-
2943-
u <- ergm_attr_levels(a$levels, nodecov, nw, sort(unique(nodecov)))
2944-
namescov <- u
2945-
2946-
nr <- length(u)
2947-
nc <- length(u)
2948-
2949-
levels2.list <- transpose(expand.grid(row = u, col = u, stringsAsFactors=FALSE))
2950-
indices2.grid <- expand.grid(row = 1:nr, col = 1:nc)
2951-
2952-
levels2.sel <- if((!hasName(attr(a,"missing"), "levels2") || attr(a,"missing")["levels2"]) && any(NVL(a$base,0)!=0)) levels2.list[-a$base]
2953-
else ergm_attr_levels(a$levels2, list(row = nodecov, col = nodecov), nw, levels2.list)
2954-
2955-
rows2keep <- match(levels2.sel,levels2.list, NA)
2956-
rows2keep <- rows2keep[!is.na(rows2keep)]
2957-
2958-
u <- indices2.grid[rows2keep,]
2959-
2960-
nodecov.indices <- match(nodecov, namescov, nomatch=length(namescov) + 1)
2961-
2962-
coef.names <- paste("hammingmix",attrname,
2963-
apply(matrix(namescov[as.matrix(u)],ncol=2),1,paste,collapse="."),
2964-
sep=".")
2965-
# Number of input parameters before covariates equals twice the number
2966-
# of used matrix cells, namely 2*length(uui),
2967-
inputs=c(to_ergm_Cdouble(xm, prototype=nw), u[,1], u[,2], nodecov.indices)
2968-
attr(inputs, "ParamsBeforeCov") <- nrow(u)
2969-
# The emptynwstats code below does not work right for
2970-
# undirected networks, mostly since hammingmix doesn't work
2971-
# in this case anyway.
2972-
nw %v% "_tmp_nodecov" <- as.vector(nodecov)
2973-
if(version <= as.package_version("3.9.4")){
2974-
emptynwstats <- summary(nw ~ nodemix("_tmp_nodecov", base=a$base))
2975-
}else{
2976-
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")]])
2977-
nodemix.call <- as.call(nodemix.call)
2978-
nodemix.form <- as.formula(call("~", nw, nodemix.call))
2979-
emptynwstats <- summary(nodemix.form)
2980-
}
2981-
list(name="hammingmix", coef.names=coef.names, inputs=inputs,
2982-
emptynwstats=emptynwstats, dependence=FALSE)
2983-
}
2984-
2985-
2986-
2987-
2988-
29892878

29902879
#=======================InitErgmTerm functions: I============================#
29912880

@@ -3074,21 +2963,6 @@ InitErgmTerm.idegree1.5<-function (nw, arglist, ...) {
30742963
}
30752964

30762965

3077-
################################################################################
3078-
#' @describeIn ergm-deprecated Use [`idegree1.5`][idegree1.5-ergmTerm] instead.
3079-
InitErgmTerm.idegreepopularity<-function (nw, arglist, ...) {
3080-
.Deprecated("idegree1.5")
3081-
a <- check.ErgmTerm(nw, arglist, directed=TRUE,
3082-
varnames = NULL,
3083-
vartypes = NULL,
3084-
defaultvalues = list(),
3085-
required = NULL)
3086-
list(name="idegreepopularity", coef.names="idegreepopularity",
3087-
minval=0, maxval=network.dyadcount(nw,FALSE)*sqrt(network.size(nw)-1), conflicts.constraints="idegreedist")
3088-
}
3089-
3090-
3091-
30922966
################################################################################
30932967

30942968
#' @templateVar name intransitive
@@ -4528,20 +4402,6 @@ InitErgmTerm.odegree1.5<-function (nw, arglist, ...) {
45284402
}
45294403

45304404

4531-
################################################################################
4532-
#' @describeIn ergm-deprecated Use [`odegree1.5`][odegree1.5-ergmTerm] instead.
4533-
InitErgmTerm.odegreepopularity<-function (nw, arglist, ...) {
4534-
.Deprecated("odegree1.5")
4535-
a <- check.ErgmTerm(nw, arglist, directed=TRUE,
4536-
varnames = NULL,
4537-
vartypes = NULL,
4538-
defaultvalues = list(),
4539-
required = NULL)
4540-
list(name="odegreepopularity", coef.names="odegreepopularity",
4541-
minval=0, maxval=network.dyadcount(nw,FALSE)*sqrt(network.size(nw)-1), conflicts.constraints="odegreedist")
4542-
}
4543-
4544-
45454405
################################################################################
45464406

45474407
#' @templateVar name opentriad

R/ergm-defunct.R

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@
7575
#'
7676
#' as.rlebdm.ergm(...)
7777
#'
78+
#' offset.info.formula(...)
79+
#'
80+
#' InitErgmTerm.degreepopularity(...)
81+
#'
82+
#' InitErgmTerm.idegreepopularity(...)
83+
#'
84+
#' InitErgmTerm.odegreepopularity(...)
85+
#'
7886
#' @description Functions that have been removed after a period of deprecation.
7987
#' @param ... Arguments to defunct functions.
8088
#' @details
@@ -140,7 +148,13 @@
140148
#'
141149
#' `as.rlebdm.ergm()`: no longer used
142150
#'
143-
#' @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
151+
#' `offset.info.formula()`: no longer used
152+
#'
153+
#' `degreepopularity`, `odegreepopularity`, `idegreepopularity`: use the corresponding `degree1.5` term
154+
#'
155+
#' `hammingmix`: use `hamming(...):nodemix(...)` for example
156+
#'
157+
#' @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
144158
#'
145159
#' @keywords internal
146160
NULL

R/formula.utils.R

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -283,13 +283,3 @@ enformulate.curved.formula <- function(object, theta, ...){
283283

284284
model.transform.formula(object, theta, recipes, ...)
285285
}
286-
287-
#' @describeIn ergm-deprecated \code{offset.info.formula} returns the offset
288-
#' vectors associated with a formula.
289-
#' @export offset.info.formula
290-
offset.info.formula <- function(object, ...){
291-
.Deprecated()
292-
nw <- ergm.getnetwork(object)
293-
m<-ergm_model(object, nw, ...)
294-
with(m$etamap, list(term=offset, theta=offsettheta,eta=offsetmap))
295-
}

man/ergm-defunct.Rd

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

man/ergm-deprecated.Rd

Lines changed: 1 addition & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/changestats.c

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2036,31 +2036,6 @@ C_CHANGESTAT_FN(c_hamming) {
20362036

20372037
}
20382038

2039-
/*****************
2040-
changestat: d_hammingmix
2041-
*****************/
2042-
C_CHANGESTAT_FN(c_hammingmix) {
2043-
2044-
Edge nhedge = INPUT_PARAM[0];
2045-
/* Rprintf("nstats %d nhedge %d i0 %f i1 %f i2 %f i3 %f\n",nstats, nhedge, INPUT_PARAM[0],
2046-
INPUT_PARAM[1],
2047-
INPUT_PARAM[2],
2048-
INPUT_PARAM[3]
2049-
); */
2050-
2051-
2052-
/* *** don't forget tail -> head */
2053-
int matchvaltail = INPUT_PARAM[tail+2*N_CHANGE_STATS+2*nhedge];
2054-
int matchvalhead = INPUT_PARAM[head+2*N_CHANGE_STATS+2*nhedge];
2055-
unsigned int discord = XOR(dEdgeListSearch(tail, head, INPUT_PARAM), edgestate);
2056-
for (unsigned int j=0; j<N_CHANGE_STATS; j++){
2057-
if(matchvaltail==INPUT_PARAM[2*nhedge+1+j] &&
2058-
matchvalhead==INPUT_PARAM[2*nhedge+1+N_CHANGE_STATS+j]){
2059-
CHANGE_STAT[j] += (discord ? -1.0 : 1.0);
2060-
}
2061-
}
2062-
}
2063-
20642039
/******************** changestats: I ***********/
20652040

20662041
// A macro indicating whether x is in [from,to)

0 commit comments

Comments
 (0)