peer.avg {PartialNetwork} | R Documentation |
Computing peer average value
Description
peer.avg
computes peer average value using network data (as a list) and observable characteristics.
Usage
peer.avg(Glist, V, export.as.list = FALSE)
Arguments
Glist |
the adjacency matrix or list sub-adjacency matrix. |
V |
vector or matrix of observable characteristics. |
export.as.list |
(optional) boolean to indicate if the output should be a list of matrices or a single matrix. |
Value
the matrix product diag(Glist[[1]], Glist[[2]], ...) %*% V
, where diag()
is the block diagonal operator.
See Also
Examples
# Generate a list of adjacency matrices
## sub-network size
N <- c(250, 370, 120)
## rate of friendship
p <- c(.2, .15, .18)
## network data
u <- unlist(lapply(1: 3, function(x) rbinom(N[x]*(N[x] - 1), 1, p[x])))
G <- vec.to.mat(u, N, normalise = TRUE)
# Generate a vector y
y <- rnorm(sum(N))
# Compute G%*%y
Gy <- peer.avg(Glist = G, V = y)
[Package PartialNetwork version 1.0.4 Index]