paramVertex: Parameter estimation for Vertex dynamics

Description Usage Arguments Details Value Author(s) Examples

View source: R/paramVertex.R

Description

Parameter estimation fro dynamic vertex case. The interface remaining almost identical to the static vertex one.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
paramVertex(
  InputNetwork,
  VertexStatsvec = rep(1, nvertexstats),
  maxLag,
  VertexLag = rep(1, maxLag),
  VertexLagMatrix = matrix(1, maxLag, length(VertexStatsvec)),
  VertexModelGroup = NA,
  VertexAttLag = rep(1, maxLag),
  dayClass = NA,
  EdgeModelTerms,
  EdgeModelFormula,
  EdgeGroup,
  EdgeIntercept = c("edges"),
  EdgeNetparam = NA,
  EdgeExvar = NA,
  EdgeLag = rep(1, maxLag),
  EdgeLagMatrix = matrix(1, maxLag, length(EdgeModelTerms)),
  regMethod = "bayesglm",
  paramout = FALSE
)

Arguments

InputNetwork

list of networks.

VertexStatsvec

binary vector of size 8.

maxLag

maximum lag, numeric.

VertexLag

binary vector of length maxLag.

VertexLagMatrix

binary matrix of size maxLag x 8.

VertexModelGroup

Grouping term for vertex model. Must be from vertex attribute list.

VertexAttLag

Lag vector for vertex group terms. Of length maxLag.

dayClass

Any network level present time attribute vector. Here used to indicate week/weekend as 0/1.

EdgeModelTerms

Model terms in edge model.

EdgeModelFormula

Model formula in edge model.

EdgeGroup

Group terms in edge model.

EdgeIntercept

Intercept for edge model.

EdgeNetparam

Network level parameter for edge model (currently only supported parameter is current network size).

EdgeExvar

Extraneous variable for edge model.

EdgeLag

binary vector of length maxLag.

EdgeLagMatrix

binary matrix of dim maxLag x length(EdgeModelTerms)

regMethod

Regression method. default: "bayesglm"

paramout

T/F Should the parameter estimates be returned?

Details

The Vertex model parameter list is as follows (Freeman degree, In degree, Out degree, Eigen Centrality, Between centrality, Info centrality, Closeness centrality, log k cycles, log size). For more details about the definitions of the terms, please refer to the vertexstats.R file, which implements all of these. The definitions are in sna or igraph.

Value

list with following elements:
EdgeCoef: edge coefficients.
Edgemplematfull: MPLE matrix from edges.
Edgemplemat: Subsetted MPLE matrix.
VertexCoef: Coefficients from vertex.
Vstats: Vertex statistics matrix.
EdgePredictor0: Edge predictors with imputations with 0.
EdgePredictor1: Edge predictors with imputations with 1.
EdgePredictorNA: Edge predictors with imputations with NA.
EdgeFit: Edge model.
VertexStatsFull: Vertex statistics matrix, full.
VertexFit: Vertex model.

Author(s)

Abhirup

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
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)


out <- paramVertex(InputNetwork = beach,
                   maxLag = 3,
                   VertexStatsvec = rep(1, nvertexstats),
                   VertexModelGroup = "regular",
                   VertexLag = rep(1, maxLag),
                   VertexLagMatrix = VertexLagMatrix,
                   dayClass = dayClass,
                   EdgeModelTerms = NA,
                   EdgeModelFormula = NA,
                   EdgeGroup = NA,
                   EdgeIntercept = c("edges"),
                   EdgeNetparam = c("logSize"),
                   EdgeExvar = NA,
                   EdgeLag = c(1, 1, 0),
                   paramout = TRUE)

dnr documentation built on Dec. 1, 2020, 1:07 a.m.