engineVertex {dnr} | R Documentation |
Simulation Engine for dynamic Vertex case.
Description
Simulation engine for dynamic networks with variable number of vertices. Implements exponential family based hierarchical model for vertices and the edges.
Usage
engineVertex(
InputNetwork,
numSim,
maxLag,
VertexStatsvec = rep(1, nvertexstats),
VertexLag = rep(1, maxLag),
VertexLagMatrix = matrix(1, maxLag, length(VertexStatsvec)),
VertexModelGroup = NA,
VertexAttLag = rep(1, maxLag),
dayClassObserved = NA,
dayClassFuture = NA,
EdgeModelTerms,
EdgeModelFormula,
EdgeGroup = NA,
EdgeIntercept = c("edges"),
EdgeNetparam = NA,
EdgeExvar = NA,
EdgeLag = rep(1, maxLag),
EdgeLagMatrix = matrix(1, maxLag, length(EdgeModelTerms)),
regMethod = "bayesglm",
paramout = TRUE
)
Arguments
InputNetwork |
List of input networks |
numSim |
number of time points to simulate |
maxLag |
maximum Lag |
VertexStatsvec |
Binary vector for vertex model. |
VertexLag |
vector of lag for vertex |
VertexLagMatrix |
matrix of lags for vertex stats. |
VertexModelGroup |
Group term for vertex model. |
VertexAttLag |
Lag vector for group term for vertex. |
dayClassObserved |
Observed day class. |
dayClassFuture |
Dayclass vector for future, must be of size numsim. |
EdgeModelTerms |
Edge Model terms |
EdgeModelFormula |
Edge model formula |
EdgeGroup |
edge group term |
EdgeIntercept |
edge intercept |
EdgeNetparam |
edge network parameter name |
EdgeExvar |
edge extraneous variable |
EdgeLag |
edge Lag vector |
EdgeLagMatrix |
edge lag matrix |
regMethod |
regression method. "bayesglm" by default |
paramout |
T/F on if regression needs to run. |
Value
List with following elements: SimNetwork: Output Networks EdgeParameterMat: Matrix of edge parameter VertexParameterMat: Matrix of Vertex parameters.
Author(s)
Abhirup
Examples
## Not run:
nvertexstats <- 9
maxLag = 3
VertexLag = rep(1, maxLag)
VertexLagMatrix <- matrix(0, maxLag, nvertexstats)
VertexLagMatrix[, c(4, 7)] <- 1
VertexLagMatrix[c(2,3),7] <- 0
getWeekend <- function(z){
weekends <- c("Saturday", "Sunday")
if(!network::is.network(z)){
if(is.na(z)) return(NA)
} else {
zDay <- get.network.attribute(z, attrname = "day")
out <- ifelse(zDay %in% weekends, 1, 0)
return(out)
}
}
dayClass <- numeric(length(beach))
for(i in seq_along(dayClass)) {
dayClass[i] <- getWeekend(beach[[i]])
}
dayClass <- na.omit(dayClass)
simResult <- suppressWarnings(engineVertex(InputNetwork = beach,
numSim = 5,
maxLag = 3,
VertexStatsvec = rep(1, nvertexstats),
VertexModelGroup = "regular",
VertexAttLag = rep(1, maxLag),
VertexLag = rep(1, maxLag),
VertexLagMatrix = VertexLagMatrix,
dayClassObserved = dayClass,
dayClassFuture = c(1, 0, 0, 0, 0),
EdgeModelTerms = NA,
EdgeModelFormula = NA,
EdgeGroup = NA,
EdgeIntercept = c("edges"),
EdgeNetparam = c("logSize"),
EdgeExvar = NA,
EdgeLag = c(0, 1, 0),
paramout = TRUE
))
## End(Not run)