Convert Network from Sparse Adjacency Matrix into Network IDs...

Description Usage Arguments Value See Also

View source: R/network.R


Convert network represented by a sparse adjacency matrix into simcausal network IDs matrix (NetInd_k).


1, trimKmax)



Network represented as a sparse adjacency matrix (S4 class object dgCMatrix from package Matrix). NOTE: The friends (row numbers) of observation i are assumed to be listed in column i (i.e, which(sparseAdjMat[,i]) are friends of i).


Trim the maximum number of friends to this integer value. If this argument is not missing, the conversion network matrix obtained from sparseAdjMat will be trimmed, so that each observation has at most trimKmax friends. The trimming initiates from the last column of the network ID matrix, removing columns until only trimKmax columns are left.


A named list with 3 items: 1) NetInd_k; 2) nF; and 3) Kmax. 1) NetInd_k - matrix of network IDs of dimension (n=nrow(sparseAdjMat),Kmax), where each row i consists of the network IDs (friends) for observation i. Remainders are filled with NAs. 2) nF - integer vector of length n specifying the number of friends for each observation. 3) Kmax - integer constant specifying the maximum observed number of friends in input sparseAdjMat (this is the column dimension for the output matrix NetInd_k).

See Also


osofr/simcausal documentation built on Jan. 6, 2019, 3:05 a.m.