-
Notifications
You must be signed in to change notification settings - Fork 4
Home
Samuel Jenness edited this page Oct 19, 2015
·
7 revisions
The following is an outline of the change statistics and other processes that must be updated at each time step for the ERGM network statistics commonly used in our research. The goal is to have an automated process for updating these given an ERGM formula, but for now this must be handled with user-defined modules.
inputs <- c(0, 1, 0) # not changed
mf$terms[[1]]$maxval <- maxdyads
mf$terms[[3]]$maxval <- n
nodecov <- dat$attr$male
u <- sort(unique(nodecov))
nodecov <- match(nodecov, u)
ui <- seq(along = u)
inputs <- c(ui, nodecov)
outputs <- c(0, 2, length(inputs), inputs)
mf$terms[[2]]$inputs <- outputs
mf$terms[[2]]$maxval <- n
nodecov <- dat$attr$deg.pers
u <- sort(unique(nodecov))
u <- u[-1] # remove base values here
nodecov <- match(nodecov, u, nomatch = length(u) + 1)
ui <- seq(along = u)
inputs <- c(ui, nodecov)
mf$terms[[2]]$inputs <- c(length(ui), length(mf$terms[[2]]$coef.names), length(inputs), inputs)
nodecov <- do.call(paste, c(sapply(c("deg.main", "deg.pers"),
function(oneattr) dat$attr[[oneattr]],
simplify = FALSE), sep = "."))
u <- sort(unique(nodecov))
u <- u[-1] # remove base values here
nodecov <- match(nodecov, u, nomatch = length(u) + 1)
ui <- seq(along = u)
inputs <- c(ui, nodecov)
mf$terms[[2]]$inputs <- c(length(ui), length(mf$terms[[2]]$coef.names), length(inputs), inputs)
nodecov <- dat$attr$role.class
u <- sort(unique(nodecov))
u <- u[1:2] # keep = 1:2
nodecov <- match(nodecov, u, nomatch = length(u) + 1)
dontmatch <- nodecov == (length(u) + 1)
nodecov[dontmatch] <- length(u) + (1:sum(dontmatch))
ui <- seq(along = u)
inputs <- c(ui, nodecov)
mf$terms[[4]]$inputs <- c(0, length(mf$terms[[4]]$coef.names), length(inputs), inputs)
nodecov <- dat$attr$male
u <- sort(unique(nodecov))
nodecov <- match(nodecov, u, nomatch = length(u) + 1)
inputs <- nodecov
mf$terms[[2]]$inputs <- c(0, 1, length(inputs), inputs)
nodecov <- dat$attr$age
nodeby <- dat$attr$male
offsetVal <- mf$terms[[3]]$inputs[4]
inputs <- c(offsetVal, nodecov, nodeby)
mf$terms[[3]]$inputs <- c(0, 1, length(inputs), inputs)