Skip to content

Commit

Permalink
In layered *SP effects, use integer inputs.
Browse files Browse the repository at this point in the history
  • Loading branch information
krivit committed Nov 18, 2024
1 parent 8fb7133 commit 3f6da07
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 70 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: ergm.multi
Version: 0.2.1-4164
Date: 2024-10-08
Version: 0.2.1-4163
Date: 2024-11-18
Title: Fit, Simulate and Diagnose Exponential-Family Models for Multiple or Multilayer Networks
Authors@R: c(person(c("Pavel", "N."), "Krivitsky", role=c("aut","cre"), email="[email protected]", comment=c(ORCID="0000-0002-9101-3362")),
person(c("Mark", "S."), "Handcock", role=c("ctb"), email="[email protected]"),
Expand Down
18 changes: 9 additions & 9 deletions R/InitErgmTerm.dgw_sp.R
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ InitErgmTerm.despL<-function(nw, arglist, cache.sp=TRUE, ...) {

linfo <- .sp.handle_layers(nw, a, type, TRUE, cache.sp)

if(length(linfo)) list(name=paste0(dname,linfo$name_suffix), coef.names=linfo$coef.namewrap(paste(conam,d,sep="")), auxiliaries=linfo$auxiliaries, inputs=c(linfo$any_order,typecode,d), minval=0)
if(length(linfo)) list(name=paste0(dname,linfo$name_suffix), coef.names=linfo$coef.namewrap(paste(conam,d,sep="")), auxiliaries=linfo$auxiliaries, iinputs=c(linfo$any_order,typecode,d), minval=0)
else no_layer_err("desp()")
}

Expand Down Expand Up @@ -338,7 +338,7 @@ InitErgmTerm.dgwespL<-function(nw, arglist, cache.sp=TRUE, gw.cutoff=30, ...) {

if(length(linfo)) c(list(name=paste0(dname,linfo$name_suffix),
coef.names=linfo$coef.namewrap(if(is.directed(nw)) paste("esp.",type,"#",d,sep="") else paste("esp#",d,sep="")),auxiliaries=linfo$auxiliaries,
inputs=c(linfo$any_order,typecode,d), params=params), GWDECAY)
iinputs=c(linfo$any_order,typecode,d), params=params), GWDECAY)
else no_layer_err("dgwesp()")
}else{
if(is.null(a$decay)) stop("Term 'dgwesp' with 'fixed=TRUE' requires a decay parameter 'decay'.", call.=FALSE)
Expand All @@ -350,7 +350,7 @@ InitErgmTerm.dgwespL<-function(nw, arglist, cache.sp=TRUE, gw.cutoff=30, ...) {
else
coef.names <- paste("gwesp.fixed.",decay,sep="")

if(length(linfo)) list(name=paste0(dname,linfo$name_suffix), coef.names=linfo$coef.namewrap(coef.names), inputs=c(linfo$any_order,decay,typecode,maxesp),auxiliaries=linfo$auxiliaries)
if(length(linfo)) list(name=paste0(dname,linfo$name_suffix), coef.names=linfo$coef.namewrap(coef.names), inputs=decay, iinputs=c(linfo$any_order,typecode,maxesp), auxiliaries=linfo$auxiliaries)
else no_layer_err("dgwesp()")
}
}
Expand Down Expand Up @@ -439,7 +439,7 @@ InitErgmTerm.ddspL<-function(nw, arglist, cache.sp=TRUE, ...) {
emptynwstats <- NULL
}

if(length(linfo)) list(name=paste0(dname,linfo$name_suffix), coef.names=linfo$coef.namewrap(paste0(conam,d)), auxiliaries=linfo$auxiliaries, inputs=c(linfo$any_order,typecode,d), minval=0, emptynwstats=emptynwstats)
if(length(linfo)) list(name=paste0(dname,linfo$name_suffix), coef.names=linfo$coef.namewrap(paste0(conam,d)), auxiliaries=linfo$auxiliaries, iinputs=c(linfo$any_order,typecode,d), minval=0, emptynwstats=emptynwstats)
else no_layer_err("ddsp()")
}

Expand Down Expand Up @@ -519,7 +519,7 @@ InitErgmTerm.dgwdspL<-function(nw, arglist, cache.sp=TRUE, gw.cutoff=30, ...) {

if(length(linfo)) c(list(name=paste0(dname,linfo$name_suffix),
coef.names=linfo$coef.namewrap(if(is.directed(nw)) paste("dsp.",type,"#",d,sep="") else paste("dsp#",d,sep="")),
inputs=c(linfo$any_order,typecode,d), params=params,
iinputs=c(linfo$any_order,typecode,d), params=params,
auxiliaries = linfo$auxiliaries), GWDECAY)
else no_layer_err("dgwdsp()")
}else{
Expand All @@ -532,7 +532,7 @@ InitErgmTerm.dgwdspL<-function(nw, arglist, cache.sp=TRUE, gw.cutoff=30, ...) {
else
coef.names <- paste("gwdsp.fixed",decay,sep=".")

if(length(linfo)) list(name=paste0(dname,linfo$name_suffix), coef.names=linfo$coef.namewrap(coef.names), inputs=c(linfo$any_order, decay,typecode,maxesp), auxiliaries=linfo$auxiliaries)
if(length(linfo)) list(name=paste0(dname,linfo$name_suffix), coef.names=linfo$coef.namewrap(coef.names), inputs=decay, iinputs=c(linfo$any_order,typecode,maxesp), auxiliaries=linfo$auxiliaries)
else no_layer_err("dgwdspL()")
}
}
Expand Down Expand Up @@ -621,7 +621,7 @@ InitErgmTerm.dnspL<-function(nw, arglist, cache.sp=TRUE, ...) {
}else{
emptynwstats <- NULL
}
if(length(linfo)) list(name=paste0(dname,linfo$name_suffix), coef.names=linfo$coef.namewrap(paste0(conam,d)), auxiliaries=linfo$auxiliaries, inputs=c(linfo$any_order,typecode,d), minval=0, emptynwstats=emptynwstats)
if(length(linfo)) list(name=paste0(dname,linfo$name_suffix), coef.names=linfo$coef.namewrap(paste0(conam,d)), auxiliaries=linfo$auxiliaries, iinputs=c(linfo$any_order,typecode,d), minval=0, emptynwstats=emptynwstats)
else no_layer_err("dnspL()")
}

Expand Down Expand Up @@ -702,7 +702,7 @@ InitErgmTerm.dgwnspL<-function(nw, arglist, cache.sp=TRUE, gw.cutoff=30, ...) {

if(length(linfo)) c(list(name=paste0(dname,linfo$name_suffix),
coef.names=linfo$coef.namewrap(if(is.directed(nw)) paste("nsp.",type,"#",d,sep="") else paste("nsp#",d,sep="")),
inputs=c(linfo$any_order,typecode,d), params=params,
iinputs=c(linfo$any_order,typecode,d), params=params,
auxiliaries = linfo$auxiliaries), GWDECAY)
else no_layer_err("dgwnsp()")
}else{
Expand All @@ -715,7 +715,7 @@ InitErgmTerm.dgwnspL<-function(nw, arglist, cache.sp=TRUE, gw.cutoff=30, ...) {
else
coef.names <- paste("gwnsp.fixed",decay,sep=".")

if(length(linfo)) list(name=paste0(dname,linfo$name_suffix), coef.names=linfo$coef.namewrap(coef.names), inputs=c(linfo$any_order, decay,typecode,maxesp), auxiliaries=linfo$auxiliaries)
if(length(linfo)) list(name=paste0(dname,linfo$name_suffix), coef.names=linfo$coef.namewrap(coef.names), inputs=decay, iinputs=c(linfo$any_order,typecode,maxesp), auxiliaries=linfo$auxiliaries)
else no_layer_err("dgwnspL()")
}
}
Expand Down
2 changes: 1 addition & 1 deletion R/InitErgmTerm.spcache.multilayer.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ InitErgmTerm..spcache.netL<-function(nw, arglist, ...){
linfo <- .sp.handle_layers(nw, a, type, FALSE)


list(name=paste0(dname,linfo$name_suffix), auxiliaries=linfo$auxiliaries, inputs=c(linfo$any_order),
list(name=paste0(dname,linfo$name_suffix), auxiliaries=linfo$auxiliaries, iinputs=c(linfo$any_order),
coef.names=c(), dependence=TRUE)
}
Loading

0 comments on commit 3f6da07

Please sign in to comment.