engineEdgeBayes: Implementation of simulation engine for dynamic networks...

Description Usage Arguments Examples

View source: R/engine_bayes.R

Description

Implementation of simulation engine for dynamic networks using smoothing estimates of change statistics.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
engineEdgeBayes(
  start_network,
  inputcoeff,
  ns,
  model.terms,
  model.formula,
  graph_mode,
  group,
  intercept,
  exvar,
  maxlag,
  lagmat,
  ylag,
  lambda = NA,
  method = "bayesglm",
  alpha.glmnet,
  paramout = TRUE,
  Theta = NA
)

Arguments

start_network

Initial list of networks

inputcoeff

coefficient vector

ns

number of time points for simulation

model.terms

model terms in formula

model.formula

model formula (ergm)

graph_mode

'digraph' by default

group

group terms

intercept

intercept terms

exvar

extraneous covariates

maxlag

maximum lag

lagmat

lag matrix

ylag

lag vector for network lag terms

lambda

NA

method

'bayesglm' by default

alpha.glmnet

NA

paramout

T/F parameter estimation is returned.

Theta

= prior probability matrix.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
## Not run: 
startNet <- rdNets[1:50]
model.terms=c("triadcensus.003", "triadcensus.012", "triadcensus.102", "triadcensus.021D", "gwesp")
model.formula = net~triadcensus(0:3)+gwesp(alpha=0, fixed=FALSE, cutoff=30)-1
graph_mode <- 'digraph'
group <- 'dnc'
alpha.glmnet <- 1
method <- 'bayesglm'
maxlag <- 3
lambda <- NA
intercept <- "edges"
cdim <- length(model.terms)
lagmat <- matrix(sample(c(0,1),(maxlag+1)*cdim,replace = TRUE),ncol = cdim)
ylag <- rep(1,maxlag)
lagmat[1,] <- rep(0,ncol(lagmat))

out.coef <- paramEdge(input_network = startNet,
                model.terms = model.terms,
                model.formula = model.formula,
                graph_mode='digraph',
                group=group,intercept = intercept,
                exvar=NA,
                maxlag = maxlag,
                lagmat = lagmat,
                ylag = ylag,
                lambda = NA, method='bayesglm',
                alpha.glmnet=1)


inputcoeff <- out.coef$coef$coef.edge
nvertex <- 47 ##find vertex here
ns <- 1
exvar <- NA
for(i in seq_along(startNet)) Theta <- Theta + startNet[[i]][,]
Theta <- Theta/length(startNet)
Theta <- thresh(Theta)
out.bayes <- engineEdgeBayes(start_network=startNet,
inputcoeff=inputcoeff,
ns=ns,
model.terms=model.terms,
model.formula=model.formula,
graph_mode=graph_mode,
group=group,intercept=intercept,
exvar=exvar,
maxlag=maxlag,
lagmat=lagmat,
ylag=ylag,
lambda = NA, method='bayesglm',
alpha.glmnet=alpha.glmnet,
Theta = Theta)

## End(Not run)

SSDALab/dnr documentation built on Dec. 28, 2020, 8:02 a.m.